diff --git a/.github/actions/replay-verify/action.yaml b/.github/actions/replay-verify/action.yaml index ffd3a8ca11fa8..301eafa341238 100644 --- a/.github/actions/replay-verify/action.yaml +++ b/.github/actions/replay-verify/action.yaml @@ -10,7 +10,7 @@ runs: sudo apt-get update -y && sudo apt-get install -y expect - name: Build CLI binaries in release mode shell: bash - run: cargo build --release -p backup-cli --bin replay-verify --bin db-backup + run: cargo build --release -p aptos-backup-cli --bin replay-verify --bin db-backup - name: query latest version in backup, at the same time, pre-heat metadata cache shell: bash run: | diff --git a/Cargo.lock b/Cargo.lock index 77f7456eda814..9f827b6badf9a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -128,9 +128,11 @@ dependencies = [ "aptos-backup-cli", "aptos-bitvec", "aptos-build-info", + "aptos-cached-packages", "aptos-config", "aptos-crypto", "aptos-faucet", + "aptos-framework", "aptos-gas", "aptos-genesis", "aptos-github-client", @@ -149,12 +151,10 @@ dependencies = [ "async-trait", "base64 0.13.0", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "cached-packages", "chrono", "clap 3.2.17", "clap_complete", "dirs", - "framework", "futures", "hex", "itertools", @@ -269,8 +269,11 @@ dependencies = [ "anyhow", "aptos-api", "aptos-api-types", + "aptos-cached-packages", "aptos-config", "aptos-crypto", + "aptos-executor", + "aptos-executor-types", "aptos-genesis", "aptos-mempool", "aptos-sdk", @@ -279,9 +282,6 @@ dependencies = [ "aptos-vm", "aptosdb", "bytes 1.2.1", - "cached-packages", - "executor", - "executor-types", "goldenfile", "hyper", "mempool-notifications", @@ -330,8 +330,12 @@ name = "aptos-backup-cli" version = "0.1.0" dependencies = [ "anyhow", + "aptos-backup-service", "aptos-config", "aptos-crypto", + "aptos-executor", + "aptos-executor-test-helpers", + "aptos-executor-types", "aptos-infallible", "aptos-jellyfish-merkle", "aptos-logger", @@ -342,15 +346,13 @@ dependencies = [ "aptos-vm", "aptosdb", "async-trait", - "backup-service", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", "bytes 1.2.1", "clap 3.2.17", - "executor", - "executor-test-helpers", - "executor-types", "futures", "itertools", + "move-binary-format", + "move-bytecode-verifier", "num_cpus", "once_cell", "pin-project", @@ -369,6 +371,29 @@ dependencies = [ "warp", ] +[[package]] +name = "aptos-backup-service" +version = "0.1.0" +dependencies = [ + "anyhow", + "aptos-config", + "aptos-crypto", + "aptos-logger", + "aptos-metrics-core", + "aptos-temppath", + "aptos-types", + "aptosdb", + "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", + "bytes 1.2.1", + "hyper", + "once_cell", + "reqwest", + "serde 1.0.144", + "storage-interface", + "tokio", + "warp", +] + [[package]] name = "aptos-bitvec" version = "0.1.0" @@ -407,6 +432,14 @@ dependencies = [ "rayon", ] +[[package]] +name = "aptos-bounded-executor" +version = "0.1.0" +dependencies = [ + "futures", + "tokio", +] + [[package]] name = "aptos-build-info" version = "0.1.0" @@ -414,6 +447,20 @@ dependencies = [ "shadow-rs", ] +[[package]] +name = "aptos-cached-packages" +version = "0.1.0" +dependencies = [ + "aptos-framework", + "aptos-types", + "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", + "include_dir 0.7.2", + "move-core-types", + "once_cell", + "proptest", + "proptest-derive", +] + [[package]] name = "aptos-compression" version = "0.1.0" @@ -453,6 +500,109 @@ dependencies = [ "thiserror", ] +[[package]] +name = "aptos-consensus" +version = "0.1.0" +dependencies = [ + "anyhow", + "aptos-bitvec", + "aptos-config", + "aptos-consensus-notifications", + "aptos-consensus-types", + "aptos-crypto", + "aptos-event-notifications", + "aptos-executor", + "aptos-executor-test-helpers", + "aptos-executor-types", + "aptos-fallible", + "aptos-infallible", + "aptos-keygen", + "aptos-logger", + "aptos-mempool", + "aptos-metrics-core", + "aptos-secure-storage", + "aptos-temppath", + "aptos-types", + "aptos-vm", + "arc-swap", + "async-trait", + "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", + "byteorder", + "bytes 1.2.1", + "channel", + "claims", + "fail 0.5.0", + "futures", + "futures-channel", + "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.144", + "serde_json", + "short-hex-str", + "storage-interface", + "tempfile", + "thiserror", + "tokio", + "vm-validator", +] + +[[package]] +name = "aptos-consensus-notifications" +version = "0.1.0" +dependencies = [ + "aptos-crypto", + "aptos-types", + "async-trait", + "claims", + "futures", + "move-core-types", + "serde 1.0.144", + "thiserror", + "tokio", +] + +[[package]] +name = "aptos-consensus-types" +version = "0.1.0" +dependencies = [ + "anyhow", + "aptos-bitvec", + "aptos-crypto", + "aptos-crypto-derive", + "aptos-executor-types", + "aptos-infallible", + "aptos-types", + "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", + "futures", + "itertools", + "mirai-annotations", + "proptest", + "rayon", + "serde 1.0.144", + "serde_json", + "short-hex-str", + "tokio", +] + +[[package]] +name = "aptos-crash-handler" +version = "0.1.0" +dependencies = [ + "aptos-logger", + "backtrace", + "serde 1.0.144", + "toml", +] + [[package]] name = "aptos-crypto" version = "0.0.3" @@ -531,6 +681,34 @@ dependencies = [ "tokio", ] +[[package]] +name = "aptos-data-streaming-service" +version = "0.1.0" +dependencies = [ + "aptos-config", + "aptos-crypto", + "aptos-data-client", + "aptos-id-generator", + "aptos-infallible", + "aptos-logger", + "aptos-metrics-core", + "aptos-types", + "async-trait", + "channel", + "claims", + "enum_dispatch", + "futures", + "network", + "once_cell", + "rand 0.7.3", + "serde 1.0.144", + "short-hex-str", + "storage-service-types", + "thiserror", + "tokio", + "tokio-stream", +] + [[package]] name = "aptos-debugger" version = "0.1.0" @@ -553,6 +731,116 @@ dependencies = [ "move-vm-test-utils", ] +[[package]] +name = "aptos-event-notifications" +version = "0.1.0" +dependencies = [ + "aptos-crypto", + "aptos-executor-test-helpers", + "aptos-id-generator", + "aptos-infallible", + "aptos-state-view", + "aptos-temppath", + "aptos-types", + "aptos-vm", + "aptosdb", + "async-trait", + "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", + "channel", + "claims", + "futures", + "move-binary-format", + "move-core-types", + "serde 1.0.144", + "storage-interface", + "thiserror", + "vm-genesis", +] + +[[package]] +name = "aptos-executor" +version = "0.1.0" +dependencies = [ + "anyhow", + "aptos-cached-packages", + "aptos-config", + "aptos-consensus-types", + "aptos-crypto", + "aptos-executor-test-helpers", + "aptos-executor-types", + "aptos-gas", + "aptos-genesis", + "aptos-infallible", + "aptos-logger", + "aptos-metrics-core", + "aptos-secure-net", + "aptos-state-view", + "aptos-temppath", + "aptos-types", + "aptos-vm", + "aptosdb", + "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", + "fail 0.5.0", + "itertools", + "move-core-types", + "once_cell", + "proptest", + "rand 0.7.3", + "rayon", + "scratchpad", + "serde 1.0.144", + "storage-interface", + "vm-genesis", +] + +[[package]] +name = "aptos-executor-test-helpers" +version = "0.1.0" +dependencies = [ + "anyhow", + "aptos-cached-packages", + "aptos-config", + "aptos-consensus-types", + "aptos-crypto", + "aptos-executor", + "aptos-executor-types", + "aptos-genesis", + "aptos-sdk", + "aptos-state-view", + "aptos-temppath", + "aptos-types", + "aptos-vm", + "aptosdb", + "rand 0.7.3", + "storage-interface", + "vm-genesis", +] + +[[package]] +name = "aptos-executor-types" +version = "0.1.0" +dependencies = [ + "anyhow", + "aptos-crypto", + "aptos-secure-net", + "aptos-state-view", + "aptos-types", + "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", + "itertools", + "once_cell", + "scratchpad", + "serde 1.0.144", + "storage-interface", + "thiserror", +] + +[[package]] +name = "aptos-fallible" +version = "0.1.0" +dependencies = [ + "thiserror", +] + [[package]] name = "aptos-faucet" version = "0.1.0" @@ -592,29 +880,162 @@ dependencies = [ "aptos-faucet", "aptos-logger", "aptos-sdk", - "clap 3.2.17", - "serde 1.0.144", + "clap 3.2.17", + "serde 1.0.144", + "serde_yaml 0.8.26", + "tokio", + "url", +] + +[[package]] +name = "aptos-fn-check-client" +version = "0.1.0" +dependencies = [ + "anyhow", + "aptos-node-checker", + "aptos-sdk", + "clap 3.2.17", + "env_logger 0.9.0", + "futures", + "gcp-bigquery-client", + "log", + "reqwest", + "serde 1.0.144", + "serde_json", + "tokio", +] + +[[package]] +name = "aptos-forge" +version = "0.0.0" +dependencies = [ + "again", + "anyhow", + "aptos", + "aptos-cached-packages", + "aptos-config", + "aptos-framework", + "aptos-genesis", + "aptos-global-constants", + "aptos-infallible", + "aptos-logger", + "aptos-rest-client", + "aptos-retrier", + "aptos-sdk", + "aptos-secure-storage", + "aptosdb", + "async-trait", + "chrono", + "either", + "futures", + "hex", + "hyper", + "hyper-tls", + "inspection-service", + "itertools", + "json-patch", + "k8s-openapi", + "kube", + "num_cpus", + "once_cell", + "prometheus-http-query", + "rand 0.7.3", + "rayon", + "regex", + "reqwest", + "serde 1.0.144", + "serde_json", + "serde_yaml 0.8.26", + "state-sync-driver", + "structopt", + "tempfile", + "termcolor", + "thiserror", + "tokio", + "transaction-emitter-lib", + "url", +] + +[[package]] +name = "aptos-forge-cli" +version = "0.0.0" +dependencies = [ + "anyhow", + "aptos-cached-packages", + "aptos-config", + "aptos-forge", + "aptos-framework", + "aptos-global-constants", + "aptos-logger", + "aptos-rest-client", + "aptos-sdk", + "async-trait", + "jemallocator", "serde_yaml 0.8.26", + "structopt", + "testcases", "tokio", "url", ] [[package]] -name = "aptos-fn-check-client" +name = "aptos-framework" version = "0.1.0" dependencies = [ "anyhow", - "aptos-node-checker", - "aptos-sdk", + "aptos-aggregator", + "aptos-cached-packages", + "aptos-crypto", + "aptos-gas", + "aptos-gas-algebra-ext", + "aptos-module-verifier", + "aptos-sdk-builder", + "aptos-state-view", + "aptos-types", + "aptos-vm", + "base64 0.13.0", + "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", + "better_any", + "claims", "clap 3.2.17", - "env_logger 0.9.0", - "futures", - "gcp-bigquery-client", + "codespan-reporting", + "curve25519-dalek", + "flate2", + "include_dir 0.7.2", + "itertools", + "libsecp256k1", "log", - "reqwest", + "move-binary-format", + "move-cli", + "move-command-line-common", + "move-compiler", + "move-core-types", + "move-docgen", + "move-model", + "move-package", + "move-prover", + "move-prover-boogie-backend", + "move-stackless-bytecode", + "move-table-extension", + "move-unit-test", + "move-vm-runtime", + "move-vm-types", + "once_cell", + "proptest", + "proptest-derive", + "rand_core 0.5.1", + "rayon", + "ripemd", "serde 1.0.144", + "serde_bytes", "serde_json", - "tokio", + "serde_yaml 0.8.26", + "sha2 0.9.9", + "sha3", + "siphasher", + "smallvec", + "tempfile", + "tiny-keccak", ] [[package]] @@ -632,7 +1053,11 @@ version = "0.1.0" dependencies = [ "anyhow", "aptos-accumulator", + "aptos-consensus", + "aptos-consensus-types", "aptos-crypto", + "aptos-executor", + "aptos-executor-types", "aptos-jellyfish-merkle", "aptos-mempool", "aptos-proptest-helpers", @@ -641,11 +1066,7 @@ dependencies = [ "aptosdb", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", "byteorder", - "consensus", - "consensus-types", "datatest-stable", - "executor", - "executor-types", "hex", "language-e2e-tests", "move-binary-format", @@ -670,12 +1091,12 @@ name = "aptos-gas" version = "0.1.0" dependencies = [ "anyhow", + "aptos-framework", + "aptos-gas-algebra-ext", "aptos-global-constants", "aptos-types", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", "clap 3.2.17", - "framework", - "gas-algebra-ext", "move-binary-format", "move-core-types", "move-model", @@ -686,13 +1107,23 @@ dependencies = [ "tempfile", ] +[[package]] +name = "aptos-gas-algebra-ext" +version = "0.0.1" +dependencies = [ + "move-core-types", +] + [[package]] name = "aptos-genesis" version = "0.1.0" dependencies = [ "anyhow", + "aptos-cached-packages", "aptos-config", "aptos-crypto", + "aptos-executor", + "aptos-framework", "aptos-keygen", "aptos-logger", "aptos-state-view", @@ -701,9 +1132,6 @@ dependencies = [ "aptos-vm", "aptosdb", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "cached-packages", - "executor", - "framework", "rand 0.7.3", "serde 1.0.144", "serde_yaml 0.8.26", @@ -847,9 +1275,12 @@ name = "aptos-mempool" version = "0.1.0" dependencies = [ "anyhow", + "aptos-bounded-executor", "aptos-compression", "aptos-config", + "aptos-consensus-types", "aptos-crypto", + "aptos-event-notifications", "aptos-id-generator", "aptos-infallible", "aptos-logger", @@ -858,11 +1289,8 @@ dependencies = [ "aptos-types", "async-trait", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "bounded-executor", "channel", - "consensus-types", "enum_dispatch", - "event-notifications", "fail 0.5.0", "futures", "itertools", @@ -922,10 +1350,20 @@ version = "0.1.0" dependencies = [ "anyhow", "aptos-api", + "aptos-backup-service", "aptos-build-info", + "aptos-cached-packages", "aptos-config", + "aptos-consensus", + "aptos-consensus-notifications", + "aptos-crash-handler", "aptos-crypto", "aptos-data-client", + "aptos-data-streaming-service", + "aptos-event-notifications", + "aptos-executor", + "aptos-executor-types", + "aptos-framework", "aptos-genesis", "aptos-indexer", "aptos-infallible", @@ -939,19 +1377,9 @@ dependencies = [ "aptos-types", "aptos-vm", "aptosdb", - "backup-service", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "cached-packages", "clap 3.2.17", - "consensus", - "consensus-notifications", - "crash-handler", - "data-streaming-service", - "event-notifications", - "executor", - "executor-types", "fail 0.5.0", - "framework", "futures", "hex", "inspection-service", @@ -1132,6 +1560,7 @@ name = "aptos-rosetta" version = "0.0.1" dependencies = [ "anyhow", + "aptos-cached-packages", "aptos-config", "aptos-crypto", "aptos-global-constants", @@ -1142,7 +1571,6 @@ dependencies = [ "aptos-types", "aptos-warp-webserver", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "cached-packages", "clap 3.2.17", "futures", "hex", @@ -1180,12 +1608,12 @@ name = "aptos-sdk" version = "0.0.3" dependencies = [ "anyhow", + "aptos-cached-packages", "aptos-crypto", "aptos-global-constants", "aptos-rest-client", "aptos-types", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "cached-packages", "ed25519-dalek-bip32", "move-core-types", "once_cell", @@ -1202,10 +1630,10 @@ name = "aptos-sdk-builder" version = "0.1.0" dependencies = [ "anyhow", + "aptos-cached-packages", + "aptos-framework", "aptos-types", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "cached-packages", - "framework", "heck 0.3.3", "move-core-types", "once_cell", @@ -1275,6 +1703,7 @@ dependencies = [ "anyhow", "aptos-api", "aptos-config", + "aptos-consensus", "aptos-crypto", "aptos-infallible", "aptos-logger", @@ -1283,7 +1712,6 @@ dependencies = [ "aptos-telemetry-service", "aptos-types", "aptosdb", - "consensus", "flate2", "futures", "httpmock", @@ -1393,16 +1821,16 @@ version = "0.1.0" dependencies = [ "anyhow", "aptos-api-types", + "aptos-cached-packages", "aptos-crypto", + "aptos-framework", "aptos-gas", "aptos-state-view", "aptos-types", "aptos-vm", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "cached-packages", "clap 3.2.17", "datatest-stable", - "framework", "hex", "language-e2e-tests", "move-binary-format", @@ -1493,6 +1921,7 @@ dependencies = [ "aptos-block-executor", "aptos-crypto", "aptos-crypto-derive", + "aptos-framework", "aptos-gas", "aptos-logger", "aptos-metrics-core", @@ -1502,7 +1931,6 @@ dependencies = [ "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", "dashmap", "fail 0.5.0", - "framework", "move-binary-format", "move-bytecode-utils", "move-bytecode-verifier", @@ -1545,15 +1973,15 @@ name = "aptos-writeset-generator" version = "0.1.0" dependencies = [ "anyhow", + "aptos-cached-packages", "aptos-crypto", "aptos-crypto-derive", + "aptos-framework", "aptos-gas", "aptos-state-view", "aptos-types", "aptos-vm", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "cached-packages", - "framework", "handlebars", "move-command-line-common", "move-compiler", @@ -1572,6 +2000,7 @@ dependencies = [ "aptos-accumulator", "aptos-config", "aptos-crypto", + "aptos-executor-types", "aptos-infallible", "aptos-jellyfish-merkle", "aptos-logger", @@ -1587,7 +2016,6 @@ dependencies = [ "arr_macro", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", "byteorder", - "executor-types", "itertools", "lru", "move-core-types", @@ -1695,16 +2123,6 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" -[[package]] -name = "artifacts-test" -version = "0.1.0" -dependencies = [ - "dir-diff", - "framework", - "fs_extra", - "tempfile", -] - [[package]] name = "ascii-canvas" version = "3.0.0" @@ -2037,29 +2455,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "backup-service" -version = "0.1.0" -dependencies = [ - "anyhow", - "aptos-config", - "aptos-crypto", - "aptos-logger", - "aptos-metrics-core", - "aptos-temppath", - "aptos-types", - "aptosdb", - "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "bytes 1.2.1", - "hyper", - "once_cell", - "reqwest", - "serde 1.0.144", - "storage-interface", - "tokio", - "warp", -] - [[package]] name = "base64" version = "0.11.0" @@ -2256,14 +2651,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "bounded-executor" -version = "0.1.0" -dependencies = [ - "futures", - "tokio", -] - [[package]] name = "bstr" version = "0.2.17" @@ -2345,20 +2732,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" -[[package]] -name = "cached-packages" -version = "0.1.0" -dependencies = [ - "aptos-types", - "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "framework", - "include_dir 0.7.2", - "move-core-types", - "once_cell", - "proptest", - "proptest-derive", -] - [[package]] name = "cassowary" version = "0.3.0" @@ -2616,97 +2989,6 @@ dependencies = [ "yaml-rust", ] -[[package]] -name = "consensus" -version = "0.1.0" -dependencies = [ - "anyhow", - "aptos-bitvec", - "aptos-config", - "aptos-crypto", - "aptos-infallible", - "aptos-keygen", - "aptos-logger", - "aptos-mempool", - "aptos-metrics-core", - "aptos-secure-storage", - "aptos-temppath", - "aptos-types", - "aptos-vm", - "async-trait", - "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "byteorder", - "bytes 1.2.1", - "channel", - "claims", - "consensus-notifications", - "consensus-types", - "event-notifications", - "executor", - "executor-test-helpers", - "executor-types", - "fail 0.5.0", - "fallible", - "futures", - "futures-channel", - "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.144", - "serde_json", - "short-hex-str", - "storage-interface", - "tempfile", - "thiserror", - "tokio", - "vm-validator", -] - -[[package]] -name = "consensus-notifications" -version = "0.1.0" -dependencies = [ - "aptos-crypto", - "aptos-types", - "async-trait", - "claims", - "futures", - "move-core-types", - "serde 1.0.144", - "thiserror", - "tokio", -] - -[[package]] -name = "consensus-types" -version = "0.1.0" -dependencies = [ - "anyhow", - "aptos-bitvec", - "aptos-crypto", - "aptos-crypto-derive", - "aptos-infallible", - "aptos-types", - "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "executor-types", - "futures", - "itertools", - "mirai-annotations", - "proptest", - "rayon", - "serde 1.0.144", - "serde_json", - "short-hex-str", -] - [[package]] name = "console" version = "0.15.1" @@ -2848,16 +3130,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crash-handler" -version = "0.1.0" -dependencies = [ - "aptos-logger", - "backtrace", - "serde 1.0.144", - "toml", -] - [[package]] name = "crc32fast" version = "1.3.2" @@ -3187,58 +3459,30 @@ dependencies = [ "ident_case", "proc-macro2 1.0.43", "quote 1.0.21", - "strsim 0.10.0", - "syn 1.0.99", -] - -[[package]] -name = "darling_macro" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc69c5bfcbd2fc09a0f38451d2daf0e372e367986a83906d1b0dbc88134fb5" -dependencies = [ - "darling_core", - "quote 1.0.21", - "syn 1.0.99", -] - -[[package]] -name = "dashmap" -version = "5.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8858831f7781322e539ea39e72449c46b059638250c14344fec8d0aa6e539c" -dependencies = [ - "cfg-if", - "num_cpus", - "parking_lot 0.12.1", -] - -[[package]] -name = "data-streaming-service" -version = "0.1.0" -dependencies = [ - "aptos-config", - "aptos-crypto", - "aptos-data-client", - "aptos-id-generator", - "aptos-infallible", - "aptos-logger", - "aptos-metrics-core", - "aptos-types", - "async-trait", - "channel", - "claims", - "enum_dispatch", - "futures", - "network", - "once_cell", - "rand 0.7.3", - "serde 1.0.144", - "short-hex-str", - "storage-service-types", - "thiserror", - "tokio", - "tokio-stream", + "strsim 0.10.0", + "syn 1.0.99", +] + +[[package]] +name = "darling_macro" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc69c5bfcbd2fc09a0f38451d2daf0e372e367986a83906d1b0dbc88134fb5" +dependencies = [ + "darling_core", + "quote 1.0.21", + "syn 1.0.99", +] + +[[package]] +name = "dashmap" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8858831f7781322e539ea39e72449c46b059638250c14344fec8d0aa6e539c" +dependencies = [ + "cfg-if", + "num_cpus", + "parking_lot 0.12.1", ] [[package]] @@ -3259,12 +3503,12 @@ dependencies = [ "anyhow", "aptos-config", "aptos-crypto", + "aptos-executor", "aptos-temppath", "aptos-types", "aptos-vm", "aptosdb", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "executor", "storage-interface", "structopt", ] @@ -3395,15 +3639,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "dir-diff" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2860407d7d7e2e004bb2128510ad9e8d669e76fa005ccf567977b5d71b8b4a0b" -dependencies = [ - "walkdir", -] - [[package]] name = "directories" version = "4.0.1" @@ -3467,7 +3702,9 @@ dependencies = [ "anyhow", "aptos", "aptos-block-executor", + "aptos-cached-packages", "aptos-crypto", + "aptos-framework", "aptos-gas", "aptos-keygen", "aptos-logger", @@ -3476,8 +3713,6 @@ dependencies = [ "aptos-vm", "aptos-writeset-generator", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "cached-packages", - "framework", "hex", "itertools", "language-e2e-tests", @@ -3656,74 +3891,14 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" -[[package]] -name = "event-notifications" -version = "0.1.0" -dependencies = [ - "aptos-crypto", - "aptos-id-generator", - "aptos-infallible", - "aptos-state-view", - "aptos-temppath", - "aptos-types", - "aptos-vm", - "aptosdb", - "async-trait", - "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "channel", - "claims", - "executor-test-helpers", - "futures", - "move-binary-format", - "move-core-types", - "serde 1.0.144", - "storage-interface", - "thiserror", - "vm-genesis", -] - -[[package]] -name = "executor" -version = "0.1.0" -dependencies = [ - "anyhow", - "aptos-config", - "aptos-crypto", - "aptos-gas", - "aptos-genesis", - "aptos-infallible", - "aptos-logger", - "aptos-metrics-core", - "aptos-secure-net", - "aptos-state-view", - "aptos-temppath", - "aptos-types", - "aptos-vm", - "aptosdb", - "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "cached-packages", - "consensus-types", - "executor-test-helpers", - "executor-types", - "fail 0.5.0", - "itertools", - "move-core-types", - "once_cell", - "proptest", - "rand 0.7.3", - "rayon", - "scratchpad", - "serde 1.0.144", - "storage-interface", - "vm-genesis", -] - [[package]] name = "executor-benchmark" version = "0.1.0" dependencies = [ "aptos-config", "aptos-crypto", + "aptos-executor", + "aptos-executor-types", "aptos-genesis", "aptos-infallible", "aptos-jellyfish-merkle", @@ -3737,8 +3912,6 @@ dependencies = [ "aptosdb", "chrono", "criterion", - "executor", - "executor-types", "indicatif", "itertools", "jemallocator", @@ -3753,47 +3926,6 @@ dependencies = [ "toml", ] -[[package]] -name = "executor-test-helpers" -version = "0.1.0" -dependencies = [ - "anyhow", - "aptos-config", - "aptos-crypto", - "aptos-genesis", - "aptos-sdk", - "aptos-state-view", - "aptos-temppath", - "aptos-types", - "aptos-vm", - "aptosdb", - "cached-packages", - "consensus-types", - "executor", - "executor-types", - "rand 0.7.3", - "storage-interface", - "vm-genesis", -] - -[[package]] -name = "executor-types" -version = "0.1.0" -dependencies = [ - "anyhow", - "aptos-crypto", - "aptos-secure-net", - "aptos-state-view", - "aptos-types", - "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "itertools", - "once_cell", - "scratchpad", - "serde 1.0.144", - "storage-interface", - "thiserror", -] - [[package]] name = "fail" version = "0.4.0" @@ -3816,13 +3948,6 @@ dependencies = [ "rand 0.8.5", ] -[[package]] -name = "fallible" -version = "0.1.0" -dependencies = [ - "thiserror", -] - [[package]] name = "fastrand" version = "1.8.0" @@ -3909,79 +4034,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" -[[package]] -name = "forge" -version = "0.0.0" -dependencies = [ - "again", - "anyhow", - "aptos", - "aptos-config", - "aptos-genesis", - "aptos-global-constants", - "aptos-infallible", - "aptos-logger", - "aptos-rest-client", - "aptos-retrier", - "aptos-sdk", - "aptos-secure-storage", - "aptosdb", - "async-trait", - "cached-packages", - "chrono", - "either", - "framework", - "futures", - "hex", - "hyper", - "hyper-tls", - "inspection-service", - "itertools", - "json-patch", - "k8s-openapi", - "kube", - "num_cpus", - "once_cell", - "prometheus-http-query", - "rand 0.7.3", - "rayon", - "regex", - "reqwest", - "serde 1.0.144", - "serde_json", - "serde_yaml 0.8.26", - "state-sync-driver", - "structopt", - "tempfile", - "termcolor", - "thiserror", - "tokio", - "transaction-emitter-lib", - "url", -] - -[[package]] -name = "forge-cli" -version = "0.0.0" -dependencies = [ - "anyhow", - "aptos-config", - "aptos-global-constants", - "aptos-logger", - "aptos-rest-client", - "aptos-sdk", - "async-trait", - "cached-packages", - "forge", - "framework", - "jemallocator", - "serde_yaml 0.8.26", - "structopt", - "testcases", - "tokio", - "url", -] - [[package]] name = "form_urlencoded" version = "1.0.1" @@ -3998,66 +4050,6 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85dcb89d2b10c5f6133de2efd8c11959ce9dbb46a2f7a4cab208c4eeda6ce1ab" -[[package]] -name = "framework" -version = "0.1.0" -dependencies = [ - "anyhow", - "aptos-aggregator", - "aptos-crypto", - "aptos-gas", - "aptos-module-verifier", - "aptos-sdk-builder", - "aptos-state-view", - "aptos-types", - "aptos-vm", - "base64 0.13.0", - "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "better_any", - "cached-packages", - "claims", - "clap 3.2.17", - "codespan-reporting", - "curve25519-dalek", - "flate2", - "gas-algebra-ext", - "include_dir 0.7.2", - "itertools", - "libsecp256k1", - "log", - "move-binary-format", - "move-cli", - "move-command-line-common", - "move-compiler", - "move-core-types", - "move-docgen", - "move-model", - "move-package", - "move-prover", - "move-prover-boogie-backend", - "move-stackless-bytecode", - "move-table-extension", - "move-unit-test", - "move-vm-runtime", - "move-vm-types", - "once_cell", - "proptest", - "proptest-derive", - "rand_core 0.5.1", - "rayon", - "ripemd", - "serde 1.0.144", - "serde_bytes", - "serde_json", - "serde_yaml 0.8.26", - "sha2 0.9.9", - "sha3", - "siphasher", - "smallvec", - "tempfile", - "tiny-keccak", -] - [[package]] name = "fs_extra" version = "1.2.0" @@ -4180,13 +4172,6 @@ dependencies = [ "slab", ] -[[package]] -name = "gas-algebra-ext" -version = "0.0.1" -dependencies = [ - "move-core-types", -] - [[package]] name = "gcc" version = "0.3.55" @@ -4220,12 +4205,12 @@ version = "0.1.0" dependencies = [ "aptos-api-types", "aptos-config", + "aptos-consensus", + "aptos-consensus-types", "aptos-crypto", "aptos-crypto-derive", "aptos-types", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "consensus", - "consensus-types", "move-core-types", "network", "rand 0.7.3", @@ -5136,7 +5121,9 @@ version = "0.1.0" dependencies = [ "anyhow", "aptos-bitvec", + "aptos-cached-packages", "aptos-crypto", + "aptos-framework", "aptos-gas", "aptos-keygen", "aptos-proptest-helpers", @@ -5144,8 +5131,6 @@ dependencies = [ "aptos-types", "aptos-vm", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "cached-packages", - "framework", "goldenfile", "hex", "move-binary-format", @@ -5167,7 +5152,9 @@ name = "language-e2e-testsuite" version = "0.1.0" dependencies = [ "aptos-block-executor", + "aptos-cached-packages", "aptos-crypto", + "aptos-framework", "aptos-gas", "aptos-keygen", "aptos-logger", @@ -5176,8 +5163,6 @@ dependencies = [ "aptos-vm", "aptos-writeset-generator", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "cached-packages", - "framework", "itertools", "language-e2e-tests", "move-binary-format", @@ -6503,6 +6488,7 @@ version = "0.1.0" dependencies = [ "aptos-config", "aptos-crypto", + "aptos-event-notifications", "aptos-infallible", "aptos-logger", "aptos-secure-storage", @@ -6511,7 +6497,6 @@ dependencies = [ "async-trait", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", "channel", - "event-notifications", "futures", "netcore", "network", @@ -6528,6 +6513,7 @@ dependencies = [ "anyhow", "aptos-config", "aptos-crypto", + "aptos-event-notifications", "aptos-logger", "aptos-metrics-core", "aptos-secure-storage", @@ -6536,7 +6522,6 @@ dependencies = [ "aptos-types", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", "channel", - "event-notifications", "futures", "netcore", "network", @@ -6857,7 +6842,7 @@ name = "package-builder" version = "0.1.0" dependencies = [ "anyhow", - "framework", + "aptos-framework", "itertools", "move-command-line-common", "move-package", @@ -6965,12 +6950,12 @@ dependencies = [ 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.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "bounded-executor", "bytes 1.2.1", "channel", "futures", @@ -8215,6 +8200,7 @@ name = "safety-rules" version = "0.1.0" dependencies = [ "aptos-config", + "aptos-consensus-types", "aptos-crypto", "aptos-global-constants", "aptos-infallible", @@ -8226,7 +8212,6 @@ dependencies = [ "aptos-temppath", "aptos-types", "aptos-vault-client", - "consensus-types", "criterion", "once_cell", "proptest", @@ -8796,10 +8781,14 @@ dependencies = [ "aptos", "aptos-backup-cli", "aptos-bitvec", + "aptos-cached-packages", "aptos-config", + "aptos-consensus", "aptos-crypto", "aptos-debugger", "aptos-faucet", + "aptos-forge", + "aptos-framework", "aptos-gas", "aptos-genesis", "aptos-global-constants", @@ -8821,11 +8810,7 @@ dependencies = [ "async-trait", "base64 0.13.0", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "cached-packages", - "consensus", "diesel", - "forge", - "framework", "futures", "hex", "move-core-types", @@ -8874,8 +8859,14 @@ version = "0.1.0" dependencies = [ "anyhow", "aptos-config", + "aptos-consensus-notifications", "aptos-crypto", "aptos-data-client", + "aptos-data-streaming-service", + "aptos-event-notifications", + "aptos-executor", + "aptos-executor-test-helpers", + "aptos-executor-types", "aptos-genesis", "aptos-infallible", "aptos-logger", @@ -8889,12 +8880,6 @@ dependencies = [ "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", "channel", "claims", - "consensus-notifications", - "data-streaming-service", - "event-notifications", - "executor", - "executor-test-helpers", - "executor-types", "futures", "mempool-notifications", "mockall", @@ -8969,6 +8954,7 @@ version = "0.1.0" dependencies = [ "anyhow", "aptos-bitvec", + "aptos-bounded-executor", "aptos-config", "aptos-crypto", "aptos-infallible", @@ -8977,7 +8963,6 @@ dependencies = [ "aptos-time-service", "aptos-types", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "bounded-executor", "bytes 1.2.1", "channel", "claims", @@ -9232,6 +9217,7 @@ version = "0.0.0" dependencies = [ "anyhow", "aptos", + "aptos-forge", "aptos-genesis", "aptos-global-constants", "aptos-keygen", @@ -9239,7 +9225,6 @@ dependencies = [ "aptos-rest-client", "aptos-sdk", "aptos-types", - "forge", "futures", "hex", "move-examples", @@ -10160,15 +10145,15 @@ name = "vm-genesis" version = "0.1.0" dependencies = [ "anyhow", + "aptos-cached-packages", "aptos-crypto", + "aptos-framework", "aptos-gas", "aptos-proptest-helpers", "aptos-state-view", "aptos-types", "aptos-vm", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "cached-packages", - "framework", "move-core-types", "move-vm-types", "once_cell", @@ -10183,15 +10168,15 @@ name = "vm-validator" version = "0.1.0" dependencies = [ "anyhow", + "aptos-cached-packages", "aptos-crypto", + "aptos-executor-test-helpers", "aptos-gas", "aptos-state-view", "aptos-temppath", "aptos-types", "aptos-vm", "aptosdb", - "cached-packages", - "executor-test-helpers", "fail 0.5.0", "move-core-types", "rand 0.7.3", diff --git a/Cargo.toml b/Cargo.toml index a34e54b17e733..767fabbb7a323 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,6 @@ members = [ "aptos-move/e2e-tests", "aptos-move/e2e-testsuite", "aptos-move/framework", - "aptos-move/framework/artifacts-test", "aptos-move/framework/cached-packages", "aptos-move/gas-algebra-ext", "aptos-move/move-examples", @@ -172,7 +171,6 @@ aptos-aggregator = { path = "aptos-move/aptos-aggregator" } aptos-api = { path = "api" } aptos-api-test-context = { path = "api/test-context" } aptos-api-types = { path = "api/types" } -aptos-backup-cli = { path = "storage/backup/backup-cli" } aptos-block-executor = { path = "aptos-move/block-executor" } aptos-bitvec = { path = "crates/aptos-bitvec" } aptos-build-info = { path = "crates/aptos-build-info" } @@ -230,24 +228,24 @@ aptos-vm = { path = "aptos-move/aptos-vm" } aptos-warp-webserver = { path = "crates/aptos-warp-webserver" } aptos-writeset-generator = { path = "aptos-move/writeset-transaction-generator" } aptosdb = { path = "storage/aptosdb" } -backup-service = { path = "storage/backup/backup-service" } -bounded-executor = { path = "crates/bounded-executor" } -cached-packages = { path = "aptos-move/framework/cached-packages" } +aptos-backup-cli = { path = "storage/backup/backup-cli" } +aptos-backup-service = { path = "storage/backup/backup-service" } +aptos-bounded-executor = { path = "crates/bounded-executor" } +aptos-cached-packages = { path = "aptos-move/framework/cached-packages" } channel = { path = "crates/channel" } -consensus = { path = "consensus" } -consensus-notifications = { path = "state-sync/inter-component/consensus-notifications" } -consensus-types = { path = "consensus/consensus-types" } -crash-handler = { path = "crates/crash-handler" } -data-streaming-service = { path = "state-sync/state-sync-v2/data-streaming-service" } -event-notifications = { path = "state-sync/inter-component/event-notifications" } -executor = { path = "execution/executor" } -executor-test-helpers = { path = "execution/executor-test-helpers" } -executor-types = { path = "execution/executor-types" } -fallible = { path = "crates/fallible" } -forge = { path = "testsuite/forge" } -framework = { path = "aptos-move/framework" } -gas-algebra-ext = { path = "aptos-move/gas-algebra-ext" } -handlebars = "4.2.2" +aptos-consensus = { path = "consensus" } +aptos-consensus-notifications = { path = "state-sync/inter-component/consensus-notifications" } +aptos-consensus-types = { path = "consensus/consensus-types" } +aptos-crash-handler = { path = "crates/crash-handler" } +aptos-data-streaming-service = { path = "state-sync/state-sync-v2/data-streaming-service" } +aptos-event-notifications = { path = "state-sync/inter-component/event-notifications" } +aptos-executor = { path = "execution/executor" } +aptos-executor-test-helpers = { path = "execution/executor-test-helpers" } +aptos-executor-types = { path = "execution/executor-types" } +aptos-fallible = { path = "crates/fallible" } +aptos-forge = { path = "testsuite/forge" } +aptos-framework = { path = "aptos-move/framework" } +aptos-gas-algebra-ext = { path = "aptos-move/gas-algebra-ext" } inspection-service = { path = "crates/inspection-service" } language-e2e-tests = { path = "aptos-move/e2e-tests" } mempool-notifications = { path = "state-sync/inter-component/mempool-notifications" } @@ -336,6 +334,7 @@ futures-util = "0.3.21" gcp-bigquery-client = "0.13.0" get_if_addrs = "0.5.3" goldenfile = "1.1.0" +handlebars = "4.2.2" heck = "0.3.2" hex = "0.4.3" hkdf = "0.10.0" diff --git a/api/test-context/Cargo.toml b/api/test-context/Cargo.toml index 871b4e1b27bc6..84a3423522540 100644 --- a/api/test-context/Cargo.toml +++ b/api/test-context/Cargo.toml @@ -16,8 +16,11 @@ rust-version = { workspace = true } anyhow = { workspace = true } aptos-api = { workspace = true } aptos-api-types = { workspace = true } +aptos-cached-packages = { workspace = true } aptos-config = { workspace = true } aptos-crypto = { workspace = true } +aptos-executor = { workspace = true } +aptos-executor-types = { workspace = true } aptos-genesis = { workspace = true } aptos-mempool = { workspace = true, features = ["fuzzing"] } aptos-sdk = { workspace = true } @@ -26,9 +29,6 @@ aptos-types = { workspace = true } aptos-vm = { workspace = true } aptosdb = { workspace = true, features = ["fuzzing"] } bytes = { workspace = true } -cached-packages = { workspace = true } -executor = { workspace = true } -executor-types = { workspace = true } goldenfile = { workspace = true } hyper = { workspace = true } mempool-notifications = { workspace = true } diff --git a/api/test-context/src/test_context.rs b/api/test-context/src/test_context.rs index c26d695b9d49e..ffe6b2772ddd1 100644 --- a/api/test-context/src/test_context.rs +++ b/api/test-context/src/test_context.rs @@ -12,6 +12,8 @@ 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_executor::{block_executor::BlockExecutor, db_bootstrapper}; +use aptos_executor_types::BlockExecutorTrait; use aptos_mempool::mocks::MockSharedMempool; use aptos_sdk::{ transaction_builder::TransactionFactory, @@ -32,8 +34,6 @@ use aptos_types::{ use aptos_vm::AptosVM; use aptosdb::AptosDB; use bytes::Bytes; -use executor::{block_executor::BlockExecutor, db_bootstrapper}; -use executor_types::BlockExecutorTrait; use hyper::{HeaderMap, Response}; use mempool_notifications::MempoolNotificationSender; use storage_interface::DbReaderWriter; @@ -91,7 +91,7 @@ pub fn new_test_context(test_name: String, use_db_with_indexer: bool) -> TestCon let mut rng = ::rand::rngs::StdRng::from_seed([0u8; 32]); let builder = aptos_genesis::builder::Builder::new( tmp_dir.path(), - cached_packages::head_release_bundle().clone(), + aptos_cached_packages::head_release_bundle().clone(), ) .unwrap() .with_init_genesis_config(Some(Arc::new(|genesis_config| { diff --git a/aptos-move/aptos-gas/Cargo.toml b/aptos-move/aptos-gas/Cargo.toml index 3c17bb96afe04..e6f8c36c60dc7 100644 --- a/aptos-move/aptos-gas/Cargo.toml +++ b/aptos-move/aptos-gas/Cargo.toml @@ -14,12 +14,12 @@ rust-version = { workspace = true } [dependencies] anyhow = { workspace = true } +aptos-framework = { workspace = true } +aptos-gas-algebra-ext = { workspace = true } aptos-global-constants = { workspace = true } aptos-types = { workspace = true } bcs = { workspace = true } clap = { workspace = true } -framework = { workspace = true } -gas-algebra-ext = { workspace = true } move-binary-format = { workspace = true } move-core-types = { workspace = true } move-model = { workspace = true } diff --git a/aptos-move/aptos-gas/src/algebra.rs b/aptos-move/aptos-gas/src/algebra.rs index 6537f26f55ca9..b7fd69efd9110 100644 --- a/aptos-move/aptos-gas/src/algebra.rs +++ b/aptos-move/aptos-gas/src/algebra.rs @@ -3,7 +3,7 @@ use move_core_types::gas_algebra::{GasQuantity, InternalGasUnit, UnitDiv}; -pub use gas_algebra_ext::{ +pub use aptos_gas_algebra_ext::{ AbstractValueSize, AbstractValueSizePerArg, AbstractValueUnit, InternalGasPerAbstractValueUnit, }; diff --git a/aptos-move/aptos-gas/src/aptos_framework.rs b/aptos-move/aptos-gas/src/aptos_framework.rs index c39af747565fb..b30727c511085 100644 --- a/aptos-move/aptos-gas/src/aptos_framework.rs +++ b/aptos-move/aptos-gas/src/aptos_framework.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::gas_meter::EXECUTION_GAS_MULTIPLIER as MUL; -use framework::natives::GasParameters; +use aptos_framework::natives::GasParameters; crate::natives::define_gas_parameters_for_natives!(GasParameters, "aptos_framework", [ [.account.create_address.base, "account.create_address.base", 300 * MUL], diff --git a/aptos-move/aptos-gas/src/gas_meter.rs b/aptos-move/aptos-gas/src/gas_meter.rs index ee0d412bf5fc3..7d3208ac5b4a6 100644 --- a/aptos-move/aptos-gas/src/gas_meter.rs +++ b/aptos-move/aptos-gas/src/gas_meter.rs @@ -71,7 +71,7 @@ pub trait InitialGasSchedule: Sized { #[derive(Debug, Clone)] pub struct NativeGasParameters { pub move_stdlib: move_stdlib::natives::GasParameters, - pub aptos_framework: framework::natives::GasParameters, + pub aptos_framework: aptos_framework::natives::GasParameters, pub table: move_table_extension::GasParameters, } @@ -98,7 +98,7 @@ impl NativeGasParameters { pub fn zeros() -> Self { Self { move_stdlib: move_stdlib::natives::GasParameters::zeros(), - aptos_framework: framework::natives::GasParameters::zeros(), + aptos_framework: aptos_framework::natives::GasParameters::zeros(), table: move_table_extension::GasParameters::zeros(), } } diff --git a/aptos-move/aptos-gas/tests/gen_tests.rs b/aptos-move/aptos-gas/tests/gen_tests.rs index 72f089e798c30..0ca81df52d472 100644 --- a/aptos-move/aptos-gas/tests/gen_tests.rs +++ b/aptos-move/aptos-gas/tests/gen_tests.rs @@ -1,8 +1,8 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 +use aptos_framework::{BuildOptions, BuiltPackage}; use aptos_gas::gen::{generate_update_proposal, GenArgs}; -use framework::{BuildOptions, BuiltPackage}; #[test] fn can_generate_and_build_update_proposal() { diff --git a/aptos-move/aptos-sdk-builder/Cargo.toml b/aptos-move/aptos-sdk-builder/Cargo.toml index 6fb557c137745..d81e634274a13 100644 --- a/aptos-move/aptos-sdk-builder/Cargo.toml +++ b/aptos-move/aptos-sdk-builder/Cargo.toml @@ -27,8 +27,8 @@ structopt = { workspace = true } textwrap = { workspace = true } [dev-dependencies] -cached-packages = { workspace = true } -framework = { workspace = true } +aptos-cached-packages = { workspace = true } +aptos-framework = { workspace = true } tempfile = { workspace = true } which = { workspace = true } diff --git a/aptos-move/aptos-sdk-builder/examples/rust/script_fun_demo.rs b/aptos-move/aptos-sdk-builder/examples/rust/script_fun_demo.rs index 5ce619dfadfc0..37b9de0e3f6b8 100644 --- a/aptos-move/aptos-sdk-builder/examples/rust/script_fun_demo.rs +++ b/aptos-move/aptos-sdk-builder/examples/rust/script_fun_demo.rs @@ -1,8 +1,8 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 +use aptos_framework::{aptos_coin_transfer, EntryFunctionCall}; use aptos_types::AccountAddress; -use framework::{aptos_coin_transfer, EntryFunctionCall}; fn demo_p2p_entry_function() { let payee = AccountAddress([ diff --git a/aptos-move/aptos-sdk-builder/tests/generation.rs b/aptos-move/aptos-sdk-builder/tests/generation.rs index 1948d8b8a3c2b..4e488188892d9 100644 --- a/aptos-move/aptos-sdk-builder/tests/generation.rs +++ b/aptos-move/aptos-sdk-builder/tests/generation.rs @@ -87,7 +87,7 @@ fn test_that_rust_entry_fun_code_compiles() { // TODO: need a way to get abis to reactivate this test let abis = vec![]; test_rust( - &abis, // &cached_packages::head_release_bundle().abis(), + &abis, // &aptos_cached_packages::head_release_bundle().abis(), "examples/rust/script_fun_demo.rs", EXPECTED_SCRIPT_FUN_OUTPUT, ); diff --git a/aptos-move/aptos-transactional-test-harness/Cargo.toml b/aptos-move/aptos-transactional-test-harness/Cargo.toml index 98403b3079248..89a2af06800fa 100644 --- a/aptos-move/aptos-transactional-test-harness/Cargo.toml +++ b/aptos-move/aptos-transactional-test-harness/Cargo.toml @@ -15,15 +15,15 @@ rust-version = { workspace = true } [dependencies] anyhow = { workspace = true } aptos-api-types = { workspace = true } +aptos-cached-packages = { workspace = true } aptos-crypto = { workspace = true } +aptos-framework = { workspace = true } aptos-gas = { workspace = true } aptos-state-view = { workspace = true } aptos-types = { workspace = true } aptos-vm = { workspace = true } bcs = { workspace = true } -cached-packages = { workspace = true } clap = { workspace = true } -framework = { workspace = true } hex = { workspace = true } language-e2e-tests = { workspace = true } move-binary-format = { workspace = true, features = [ "fuzzing" ] } diff --git a/aptos-move/aptos-transactional-test-harness/src/aptos_test_harness.rs b/aptos-move/aptos-transactional-test-harness/src/aptos_test_harness.rs index bb7dbac8f79df..affaa93807c33 100644 --- a/aptos-move/aptos-transactional-test-harness/src/aptos_test_harness.rs +++ b/aptos-move/aptos-transactional-test-harness/src/aptos_test_harness.rs @@ -285,8 +285,10 @@ fn panic_missing_private_key(cmd_name: &str) -> ! { static PRECOMPILED_APTOS_FRAMEWORK: Lazy = Lazy::new(|| { let deps = vec![PackagePaths { name: None, - paths: cached_packages::head_release_bundle().files().unwrap(), - named_address_map: framework::named_addresses().clone(), + paths: aptos_cached_packages::head_release_bundle() + .files() + .unwrap(), + named_address_map: aptos_framework::named_addresses().clone(), }]; let program_res = move_compiler::construct_pre_compiled_lib( deps, @@ -505,7 +507,7 @@ impl<'a> AptosTestAdapter<'a> { let txn = RawTransaction::new( aptos_test_root_address(), parameters.sequence_number, - cached_packages::aptos_stdlib::aptos_account_create_account(account_addr), + aptos_cached_packages::aptos_stdlib::aptos_account_create_account(account_addr), parameters.max_gas_amount, parameters.gas_unit_price, parameters.expiration_timestamp_secs, @@ -521,7 +523,7 @@ impl<'a> AptosTestAdapter<'a> { let txn = RawTransaction::new( aptos_test_root_address(), parameters.sequence_number + 1, - cached_packages::aptos_stdlib::aptos_coin_mint(account_addr, amount), + aptos_cached_packages::aptos_stdlib::aptos_coin_mint(account_addr, amount), parameters.max_gas_amount, parameters.gas_unit_price, parameters.expiration_timestamp_secs, @@ -564,7 +566,7 @@ impl<'a> MoveTestAdapter<'a> for AptosTestAdapter<'a> { None => BTreeMap::new(), }; - let mut named_address_mapping = framework::named_addresses().clone(); + let mut named_address_mapping = aptos_framework::named_addresses().clone(); for (name, addr) in additional_named_address_mapping.clone() { if named_address_mapping.contains_key(&name) { diff --git a/aptos-move/aptos-vm/Cargo.toml b/aptos-move/aptos-vm/Cargo.toml index 760111e37fe42..9c756a76f5b94 100644 --- a/aptos-move/aptos-vm/Cargo.toml +++ b/aptos-move/aptos-vm/Cargo.toml @@ -18,6 +18,7 @@ aptos-aggregator = { workspace = true } aptos-block-executor = { workspace = true } aptos-crypto = { workspace = true } aptos-crypto-derive = { workspace = true } +aptos-framework = { workspace = true } aptos-gas = { workspace = true } aptos-logger = { workspace = true } aptos-metrics-core = { workspace = true } @@ -27,7 +28,6 @@ aptos-types = { workspace = true } bcs = { workspace = true } dashmap = { workspace = true } fail = { workspace = true } -framework = { workspace = true } move-binary-format = { workspace = true } move-bytecode-utils = { workspace = true } move-bytecode-verifier = { workspace = true } @@ -55,6 +55,6 @@ proptest = { workspace = true } [features] default = [] mirai-contracts = [] -fuzzing = ["move-core-types/fuzzing", "move-binary-format/fuzzing", "move-vm-types/fuzzing", "framework/fuzzing"] +fuzzing = ["move-core-types/fuzzing", "move-binary-format/fuzzing", "move-vm-types/fuzzing", "aptos-framework/fuzzing"] failpoints = ["fail/failpoints", "move-vm-runtime/failpoints"] -testing = ["move-unit-test", "framework/testing"] +testing = ["move-unit-test", "aptos-framework/testing"] diff --git a/aptos-move/aptos-vm/src/aptos_vm.rs b/aptos-move/aptos-vm/src/aptos_vm.rs index 2e0ab80a2fd8f..d42cfc365fcfe 100644 --- a/aptos-move/aptos-vm/src/aptos_vm.rs +++ b/aptos-move/aptos-vm/src/aptos_vm.rs @@ -25,6 +25,7 @@ use aptos_aggregator::{ transaction::{ChangeSetExt, TransactionOutputExt}, }; use aptos_crypto::HashValue; +use aptos_framework::natives::code::PublishRequest; use aptos_gas::AptosGasMeter; use aptos_logger::prelude::*; use aptos_module_verifier::module_init::verify_module_init_function; @@ -43,7 +44,6 @@ use aptos_types::{ write_set::WriteSet, }; use fail::fail_point; -use framework::natives::code::PublishRequest; use move_binary_format::{ access::ModuleAccess, errors::{verification_error, Location, PartialVMError, VMError, VMResult}, diff --git a/aptos-move/aptos-vm/src/aptos_vm_impl.rs b/aptos-move/aptos-vm/src/aptos_vm_impl.rs index 40b70849bfee9..2a8abdc1b3169 100644 --- a/aptos-move/aptos-vm/src/aptos_vm_impl.rs +++ b/aptos-move/aptos-vm/src/aptos_vm_impl.rs @@ -11,6 +11,7 @@ use crate::{ transaction_metadata::TransactionMetadata, }; use aptos_aggregator::transaction::TransactionOutputExt; +use aptos_framework::{RuntimeModuleMetadata, APTOS_METADATA_KEY}; use aptos_gas::{ AbstractValueSizeGasParameters, AptosGasParameters, FromOnChainGasSchedule, Gas, NativeGasParameters, StorageGasParameters, @@ -31,7 +32,6 @@ use aptos_types::{ }; use dashmap::DashMap; use fail::fail_point; -use framework::{RuntimeModuleMetadata, APTOS_METADATA_KEY}; use move_binary_format::{errors::VMResult, CompiledModule}; use move_core_types::{ language_storage::ModuleId, diff --git a/aptos-move/aptos-vm/src/data_cache.rs b/aptos-move/aptos-vm/src/data_cache.rs index 25bc00b3ea43a..aec72c0c43143 100644 --- a/aptos-move/aptos-vm/src/data_cache.rs +++ b/aptos-move/aptos-vm/src/data_cache.rs @@ -6,6 +6,7 @@ use crate::{counters::CRITICAL_ERRORS, create_access_path, logging::AdapterLogSc #[allow(unused_imports)] use anyhow::format_err; use anyhow::Error; +use aptos_framework::natives::state_storage::StateStorageUsageResolver; use aptos_logger::prelude::*; use aptos_state_view::{StateView, StateViewId}; use aptos_types::state_store::state_storage_usage::StateStorageUsage; @@ -14,7 +15,6 @@ use aptos_types::{ vm_status::StatusCode, write_set::WriteOp, }; use fail::fail_point; -use framework::natives::state_storage::StateStorageUsageResolver; use move_binary_format::errors::*; use move_core_types::{ account_address::AccountAddress, diff --git a/aptos-move/aptos-vm/src/move_vm_ext/mod.rs b/aptos-move/aptos-vm/src/move_vm_ext/mod.rs index cbfd103b079ce..26e2842406647 100644 --- a/aptos-move/aptos-vm/src/move_vm_ext/mod.rs +++ b/aptos-move/aptos-vm/src/move_vm_ext/mod.rs @@ -10,5 +10,6 @@ mod vm; pub use crate::move_vm_ext::{ resolver::MoveResolverExt, session::{SessionExt, SessionId, SessionOutput}, + vm::verifier_config, vm::MoveVmExt, }; diff --git a/aptos-move/aptos-vm/src/move_vm_ext/resolver.rs b/aptos-move/aptos-vm/src/move_vm_ext/resolver.rs index a370ca9f6ed3e..4c4cd10129689 100644 --- a/aptos-move/aptos-vm/src/move_vm_ext/resolver.rs +++ b/aptos-move/aptos-vm/src/move_vm_ext/resolver.rs @@ -1,7 +1,7 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 -use framework::natives::state_storage::StateStorageUsageResolver; +use aptos_framework::natives::state_storage::StateStorageUsageResolver; use move_core_types::resolver::MoveResolver; use move_table_extension::TableResolver; use std::fmt::Debug; diff --git a/aptos-move/aptos-vm/src/move_vm_ext/session.rs b/aptos-move/aptos-vm/src/move_vm_ext/session.rs index c0714423377d8..f93a584897422 100644 --- a/aptos-move/aptos-vm/src/move_vm_ext/session.rs +++ b/aptos-move/aptos-vm/src/move_vm_ext/session.rs @@ -12,6 +12,10 @@ use aptos_aggregator::{ }; use aptos_crypto::{hash::CryptoHash, HashValue}; use aptos_crypto_derive::{BCSCryptoHash, CryptoHasher}; +use aptos_framework::natives::{ + aggregator_natives::{AggregatorChange, AggregatorChangeSet, NativeAggregatorContext}, + code::{NativeCodeContext, PublishRequest}, +}; use aptos_types::{ block_metadata::BlockMetadata, contract_event::ContractEvent, @@ -19,10 +23,6 @@ use aptos_types::{ transaction::{ChangeSet, SignatureCheckedTransaction}, write_set::{WriteOp, WriteSetMut}, }; -use framework::natives::{ - aggregator_natives::{AggregatorChange, AggregatorChangeSet, NativeAggregatorContext}, - code::{NativeCodeContext, PublishRequest}, -}; use move_binary_format::errors::{Location, VMResult}; use move_core_types::{ account_address::AccountAddress, diff --git a/aptos-move/aptos-vm/src/move_vm_ext/vm.rs b/aptos-move/aptos-vm/src/move_vm_ext/vm.rs index ec74566960f73..99567f1029f0c 100644 --- a/aptos-move/aptos-vm/src/move_vm_ext/vm.rs +++ b/aptos-move/aptos-vm/src/move_vm_ext/vm.rs @@ -5,12 +5,12 @@ use crate::{ move_vm_ext::{MoveResolverExt, SessionExt, SessionId}, natives::aptos_natives, }; -use aptos_gas::{AbstractValueSizeGasParameters, NativeGasParameters}; -use framework::natives::{ +use aptos_framework::natives::{ aggregator_natives::NativeAggregatorContext, code::NativeCodeContext, cryptography::ristretto255_point::NativeRistrettoPointContext, state_storage::NativeStateStorageContext, transaction_context::NativeTransactionContext, }; +use aptos_gas::{AbstractValueSizeGasParameters, NativeGasParameters}; use move_binary_format::errors::VMResult; use move_bytecode_verifier::VerifierConfig; use move_table_extension::NativeTableContext; @@ -30,6 +30,9 @@ impl MoveVmExt { treat_friend_as_private: bool, chain_id: u8, ) -> VMResult { + let mut config = verifier_config(); + config.treat_friend_as_private = treat_friend_as_private; + Ok(Self { inner: MoveVM::new_with_configs( aptos_natives( @@ -37,15 +40,7 @@ impl MoveVmExt { abs_val_size_gas_params, gas_feature_version, ), - VerifierConfig { - max_loop_depth: Some(5), - treat_friend_as_private, - max_generic_instantiation_length: Some(32), - max_function_parameters: Some(128), - max_basic_blocks: Some(1024), - max_value_stack_size: 1024, - max_type_nodes: Some(256), - }, + config, crate::AptosVM::get_runtime_config(), )?, chain_id, @@ -96,3 +91,15 @@ impl Deref for MoveVmExt { &self.inner } } + +pub fn verifier_config() -> VerifierConfig { + VerifierConfig { + max_loop_depth: Some(5), + treat_friend_as_private: false, + max_generic_instantiation_length: Some(32), + max_function_parameters: Some(128), + max_basic_blocks: Some(1024), + max_value_stack_size: 1024, + max_type_nodes: Some(256), + } +} diff --git a/aptos-move/aptos-vm/src/natives.rs b/aptos-move/aptos-vm/src/natives.rs index 4a0aaa20125c2..9c0cccf617827 100644 --- a/aptos-move/aptos-vm/src/natives.rs +++ b/aptos-move/aptos-vm/src/natives.rs @@ -9,7 +9,7 @@ use move_vm_runtime::native_functions::NativeFunctionTable; use aptos_types::chain_id::ChainId; #[cfg(feature = "testing")] use { - framework::natives::{ + aptos_framework::natives::{ aggregator_natives::NativeAggregatorContext, code::NativeCodeContext, cryptography::ristretto255_point::NativeRistrettoPointContext, transaction_context::NativeTransactionContext, @@ -30,7 +30,7 @@ pub fn aptos_natives( move_stdlib::natives::all_natives(CORE_CODE_ADDRESS, gas_params.move_stdlib) .into_iter() .filter(|(_, name, _, _)| name.as_str() != "vector") - .chain(framework::natives::all_natives( + .chain(aptos_framework::natives::all_natives( CORE_CODE_ADDRESS, gas_params.aptos_framework, move |val| abs_val_size_gas_params.abstract_value_size(val, feature_version), diff --git a/aptos-move/e2e-move-tests/Cargo.toml b/aptos-move/e2e-move-tests/Cargo.toml index dd69eb25e13be..049c448662940 100644 --- a/aptos-move/e2e-move-tests/Cargo.toml +++ b/aptos-move/e2e-move-tests/Cargo.toml @@ -16,7 +16,9 @@ rust-version = { workspace = true } anyhow = { workspace = true } aptos = { workspace = true } aptos-block-executor = { workspace = true } +aptos-cached-packages = { workspace = true } aptos-crypto = { workspace = true } +aptos-framework = { workspace = true } aptos-gas = { workspace = true, features = ["testing"] } aptos-keygen = { workspace = true } aptos-logger = { workspace = true } @@ -25,8 +27,6 @@ aptos-types = { workspace = true } aptos-vm = { workspace = true } aptos-writeset-generator = { workspace = true } bcs = { workspace = true } -cached-packages = { workspace = true } -framework = { workspace = true } hex = { workspace = true } itertools = { workspace = true } language-e2e-tests = { workspace = true } diff --git a/aptos-move/e2e-move-tests/src/harness.rs b/aptos-move/e2e-move-tests/src/harness.rs index abf2c0aa84b8f..89afd7afaf55d 100644 --- a/aptos-move/e2e-move-tests/src/harness.rs +++ b/aptos-move/e2e-move-tests/src/harness.rs @@ -3,8 +3,11 @@ use crate::{assert_success, AptosPackageHooks}; use aptos::move_tool::MemberId; +use aptos_cached_packages::aptos_stdlib; use aptos_crypto::ed25519::Ed25519PrivateKey; use aptos_crypto::{PrivateKey, Uniform}; +use aptos_framework::natives::code::PackageMetadata; +use aptos_framework::{BuildOptions, BuiltPackage}; use aptos_gas::{AptosGasParameters, InitialGasSchedule, ToOnChainGasSchedule}; use aptos_types::contract_event::ContractEvent; use aptos_types::on_chain_config::{FeatureFlag, GasScheduleV2}; @@ -16,9 +19,6 @@ use aptos_types::{ state_store::state_key::StateKey, transaction::{EntryFunction, SignedTransaction, TransactionPayload, TransactionStatus}, }; -use cached_packages::aptos_stdlib; -use framework::natives::code::PackageMetadata; -use framework::{BuildOptions, BuiltPackage}; use language_e2e_tests::{ account::{Account, AccountData}, executor::FakeExecutor, diff --git a/aptos-move/e2e-move-tests/src/lib.rs b/aptos-move/e2e-move-tests/src/lib.rs index 4fac7782e8b46..ab9878985aadd 100644 --- a/aptos-move/e2e-move-tests/src/lib.rs +++ b/aptos-move/e2e-move-tests/src/lib.rs @@ -6,7 +6,7 @@ pub mod harness; pub mod stake; use anyhow::bail; -use framework::UPGRADE_POLICY_CUSTOM_FIELD; +use aptos_framework::UPGRADE_POLICY_CUSTOM_FIELD; pub use harness::*; use move_package::package_hooks::PackageHooks; use move_package::source_package::parsed_manifest::CustomDepInfo; diff --git a/aptos-move/e2e-move-tests/src/stake.rs b/aptos-move/e2e-move-tests/src/stake.rs index 81875f4fd6a08..c155475108308 100644 --- a/aptos-move/e2e-move-tests/src/stake.rs +++ b/aptos-move/e2e-move-tests/src/stake.rs @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 use crate::harness::MoveHarness; +use aptos_cached_packages::aptos_stdlib; use aptos_crypto::{bls12381, PrivateKey, Uniform}; use aptos_types::{ account_address::AccountAddress, account_config::CORE_CODE_ADDRESS, on_chain_config::ValidatorSet, stake_pool::StakePool, transaction::TransactionStatus, validator_config::ValidatorConfig, }; -use cached_packages::aptos_stdlib; use language_e2e_tests::account::Account; use move_core_types::parser::parse_struct_tag; 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 8ad86474ecfd8..cc62233d6ce08 100644 --- a/aptos-move/e2e-move-tests/src/tests/code_publishing.rs +++ b/aptos-move/e2e-move-tests/src/tests/code_publishing.rs @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 use crate::{assert_abort, assert_success, assert_vm_status, tests::common, MoveHarness}; +use aptos_framework::natives::code::{PackageRegistry, UpgradePolicy}; use aptos_types::account_address::{create_resource_address, AccountAddress}; use aptos_types::on_chain_config::FeatureFlag; -use framework::natives::code::{PackageRegistry, UpgradePolicy}; use move_core_types::parser::parse_struct_tag; use move_core_types::vm_status::StatusCode; use package_builder::PackageBuilder; @@ -220,9 +220,9 @@ fn code_publishing_using_resource_account() { &format!("module 0x{}::m {{ public fun f() {{}} }}", module_address), ); let pack_dir = pack.write_to_temp().unwrap(); - let package = framework::BuiltPackage::build( + let package = aptos_framework::BuiltPackage::build( pack_dir.path().to_owned(), - framework::BuildOptions::default(), + aptos_framework::BuildOptions::default(), ) .expect("building package must succeed"); @@ -234,7 +234,7 @@ fn code_publishing_using_resource_account() { let result = h.run_transaction_payload( &acc, - cached_packages::aptos_stdlib::resource_account_create_resource_account_and_publish_package( + aptos_cached_packages::aptos_stdlib::resource_account_create_resource_account_and_publish_package( vec![], bcs_metadata, code, diff --git a/aptos-move/e2e-move-tests/src/tests/error_map.rs b/aptos-move/e2e-move-tests/src/tests/error_map.rs index acd7585ddaa5a..3bf3a32b85cad 100644 --- a/aptos-move/e2e-move-tests/src/tests/error_map.rs +++ b/aptos-move/e2e-move-tests/src/tests/error_map.rs @@ -4,9 +4,9 @@ extern crate core; use crate::{assert_success, tests::common, MoveHarness}; +use aptos_framework::BuildOptions; use aptos_types::account_address::AccountAddress; use aptos_types::transaction::{ExecutionStatus, TransactionStatus}; -use framework::BuildOptions; use move_core_types::value::MoveValue; use serde::{Deserialize, Serialize}; diff --git a/aptos-move/e2e-move-tests/src/tests/gas.rs b/aptos-move/e2e-move-tests/src/tests/gas.rs index 192ed295681e8..c8645d79f1dae 100644 --- a/aptos-move/e2e-move-tests/src/tests/gas.rs +++ b/aptos-move/e2e-move-tests/src/tests/gas.rs @@ -3,9 +3,9 @@ use crate::tests::common::test_dir_path; use crate::MoveHarness; +use aptos_cached_packages::{aptos_stdlib, aptos_token_sdk_builder}; use aptos_crypto::{bls12381, PrivateKey, Uniform}; use aptos_types::account_address::{default_stake_pool_address, AccountAddress}; -use cached_packages::{aptos_stdlib, aptos_token_sdk_builder}; /// Run with `cargo test test_gas -- --nocapture` to see output. #[test] 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 08616dfcb47fd..7b788e8a24d36 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 @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use crate::{tests::common, MoveHarness}; +use aptos_framework::{BuildOptions, BuiltPackage, ReleasePackage}; use aptos_types::account_address::AccountAddress; -use framework::{BuildOptions, BuiltPackage, ReleasePackage}; use move_package::compilation::package_layout::CompiledPackageLayout; use package_builder::PackageBuilder; diff --git a/aptos-move/e2e-move-tests/src/tests/mint_nft.rs b/aptos-move/e2e-move-tests/src/tests/mint_nft.rs index b53e6e94c3410..af96cdd0e7199 100644 --- a/aptos-move/e2e-move-tests/src/tests/mint_nft.rs +++ b/aptos-move/e2e-move-tests/src/tests/mint_nft.rs @@ -53,7 +53,7 @@ fn mint_nft_e2e() { let resource_address = create_resource_address(*acc.address(), &[]); // give a named address to the `mint_nft` module publisher - let mut build_options = framework::BuildOptions::default(); + let mut build_options = aptos_framework::BuildOptions::default(); build_options .named_addresses .insert("mint_nft".to_string(), resource_address); @@ -62,7 +62,7 @@ fn mint_nft_e2e() { .insert("source_addr".to_string(), *acc.address()); // build the package from our example code - let package = framework::BuiltPackage::build( + let package = aptos_framework::BuiltPackage::build( common::test_dir_path("../../../move-examples/mint_nft/4-Getting-Production-Ready"), build_options, ) @@ -76,7 +76,7 @@ fn mint_nft_e2e() { // create the resource account and publish the module under the resource account's address let result = h.run_transaction_payload( &acc, - cached_packages::aptos_stdlib::resource_account_create_resource_account_and_publish_package( + aptos_cached_packages::aptos_stdlib::resource_account_create_resource_account_and_publish_package( vec![], bcs::to_bytes(&metadata).expect("PackageMetadata has BCS"), code, diff --git a/aptos-move/e2e-move-tests/src/tests/offer_signer_capability.rs b/aptos-move/e2e-move-tests/src/tests/offer_signer_capability.rs index 2a3b7e8d07f33..36ff67e43030a 100644 --- a/aptos-move/e2e-move-tests/src/tests/offer_signer_capability.rs +++ b/aptos-move/e2e-move-tests/src/tests/offer_signer_capability.rs @@ -2,10 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 use crate::{assert_success, MoveHarness}; +use aptos_cached_packages::aptos_stdlib; use aptos_crypto::SigningKey; use aptos_types::account_config::AccountResource; use aptos_types::{account_address::AccountAddress, account_config::CORE_CODE_ADDRESS}; -use cached_packages::aptos_stdlib; use move_core_types::parser::parse_struct_tag; use serde::{Deserialize, Serialize}; diff --git a/aptos-move/e2e-move-tests/src/tests/rotate_auth_key.rs b/aptos-move/e2e-move-tests/src/tests/rotate_auth_key.rs index bd56cbf4d825e..d06660732c387 100644 --- a/aptos-move/e2e-move-tests/src/tests/rotate_auth_key.rs +++ b/aptos-move/e2e-move-tests/src/tests/rotate_auth_key.rs @@ -3,6 +3,7 @@ use crate::{assert_success, MoveHarness}; use aptos::common::types::RotationProofChallenge; +use aptos_cached_packages::aptos_stdlib; use aptos_crypto::multi_ed25519::{MultiEd25519PrivateKey, MultiEd25519PublicKey}; use aptos_crypto::{Signature, SigningKey, Uniform, ValidCryptoMaterial}; use aptos_types::{ @@ -10,7 +11,6 @@ use aptos_types::{ account_config::CORE_CODE_ADDRESS, state_store::state_key::StateKey, state_store::table::TableHandle, transaction::authenticator::AuthenticationKey, }; -use cached_packages::aptos_stdlib; use language_e2e_tests::account::Account; use move_core_types::parser::parse_struct_tag; diff --git a/aptos-move/e2e-move-tests/src/tests/scripts.rs b/aptos-move/e2e-move-tests/src/tests/scripts.rs index c09a74c34166e..eeaa71ac63775 100644 --- a/aptos-move/e2e-move-tests/src/tests/scripts.rs +++ b/aptos-move/e2e-move-tests/src/tests/scripts.rs @@ -24,15 +24,15 @@ fn test_two_to_two_transfer() { let amount_carol = 50; let amount_david = amount_alice + amount_bob - amount_carol; - let build_options = framework::BuildOptions { + let build_options = aptos_framework::BuildOptions { with_srcs: false, with_abis: false, with_source_maps: false, with_error_map: false, - ..framework::BuildOptions::default() + ..aptos_framework::BuildOptions::default() }; - let package = framework::BuiltPackage::build( + let package = aptos_framework::BuiltPackage::build( common::test_dir_path("../../../move-examples/scripts/two_by_two_transfer"), build_options, ) diff --git a/aptos-move/e2e-move-tests/src/tests/simple_defi.rs b/aptos-move/e2e-move-tests/src/tests/simple_defi.rs index 7064fcd835249..fea362adea562 100644 --- a/aptos-move/e2e-move-tests/src/tests/simple_defi.rs +++ b/aptos-move/e2e-move-tests/src/tests/simple_defi.rs @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 use crate::{assert_success, tests::common, MoveHarness}; +use aptos_cached_packages::aptos_stdlib; +use aptos_framework::{BuildOptions, BuiltPackage}; use aptos_types::account_config::CoinStoreResource; use aptos_types::{ account_address::{create_resource_address, AccountAddress}, transaction::{EntryFunction, TransactionPayload}, }; -use cached_packages::aptos_stdlib; -use framework::{BuildOptions, BuiltPackage}; use language_e2e_tests::account::Account; use move_core_types::{ident_str, language_storage::ModuleId, parser::parse_struct_tag}; use serde::{Deserialize, Serialize}; diff --git a/aptos-move/e2e-move-tests/src/tests/stake.rs b/aptos-move/e2e-move-tests/src/tests/stake.rs index d52b62227e462..96e9c95e4a803 100644 --- a/aptos-move/e2e-move-tests/src/tests/stake.rs +++ b/aptos-move/e2e-move-tests/src/tests/stake.rs @@ -6,8 +6,8 @@ use crate::{ initialize_staking, join_validator_set, leave_validator_set, rotate_consensus_key, setup_staking, unlock_stake, withdraw_stake, MoveHarness, }; +use aptos_cached_packages::aptos_stdlib; use aptos_types::account_address::{default_stake_pool_address, AccountAddress}; -use cached_packages::aptos_stdlib; use move_core_types::language_storage::CORE_CODE_ADDRESS; #[test] diff --git a/aptos-move/e2e-move-tests/src/tests/token_event_store.rs b/aptos-move/e2e-move-tests/src/tests/token_event_store.rs index e7e69aa8e4789..b80e51497e303 100644 --- a/aptos-move/e2e-move-tests/src/tests/token_event_store.rs +++ b/aptos-move/e2e-move-tests/src/tests/token_event_store.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::MoveHarness; -use cached_packages::aptos_stdlib::aptos_token_stdlib; +use aptos_cached_packages::aptos_stdlib::aptos_token_stdlib; #[test] fn test_token_creation_with_token_events_store() { diff --git a/aptos-move/e2e-tests/Cargo.toml b/aptos-move/e2e-tests/Cargo.toml index d7fd7ff1d3059..b6f95b19f37f5 100644 --- a/aptos-move/e2e-tests/Cargo.toml +++ b/aptos-move/e2e-tests/Cargo.toml @@ -15,7 +15,9 @@ rust-version = { workspace = true } [dependencies] anyhow = { workspace = true } aptos-bitvec = { workspace = true } +aptos-cached-packages ={ workspace = true } aptos-crypto = { workspace = true, features = ["fuzzing"] } +aptos-framework = { workspace = true } aptos-gas = { workspace = true } aptos-keygen = { workspace = true } aptos-proptest-helpers = { workspace = true } @@ -23,8 +25,6 @@ aptos-state-view = { workspace = true } aptos-types = { workspace = true } aptos-vm = { workspace = true } bcs = { workspace = true } -cached-packages ={ workspace = true } -framework = { workspace = true } goldenfile = { workspace = true } hex = { workspace = true } move-binary-format = { workspace = true } diff --git a/aptos-move/e2e-tests/src/common_transactions.rs b/aptos-move/e2e-tests/src/common_transactions.rs index 4f39610014837..5747a080f82f2 100644 --- a/aptos-move/e2e-tests/src/common_transactions.rs +++ b/aptos-move/e2e-tests/src/common_transactions.rs @@ -4,8 +4,8 @@ //! Support for encoding transactions for common situations. use crate::account::Account; +use aptos_cached_packages::aptos_stdlib; use aptos_types::transaction::{Script, SignedTransaction}; -use cached_packages::aptos_stdlib; use move_ir_compiler::Compiler; use once_cell::sync::Lazy; @@ -16,7 +16,7 @@ pub static EMPTY_SCRIPT: Lazy> = Lazy::new(|| { return; } "; - let modules = cached_packages::head_release_bundle().compiled_modules(); + let modules = aptos_cached_packages::head_release_bundle().compiled_modules(); let compiler = Compiler { deps: modules.iter().collect(), }; diff --git a/aptos-move/e2e-tests/src/compile.rs b/aptos-move/e2e-tests/src/compile.rs index 3f249121ab293..436b8f0820933 100644 --- a/aptos-move/e2e-tests/src/compile.rs +++ b/aptos-move/e2e-tests/src/compile.rs @@ -11,7 +11,7 @@ use move_binary_format::CompiledModule; /// Compile the provided Move code into a blob which can be used as the code to be published /// (a Module). pub fn compile_module(code: &str) -> (CompiledModule, Module) { - let framework_modules = cached_packages::head_release_bundle().compiled_modules(); + let framework_modules = aptos_cached_packages::head_release_bundle().compiled_modules(); let compiled_module = Compiler { deps: framework_modules.iter().collect(), } @@ -30,7 +30,7 @@ pub fn compile_module(code: &str) -> (CompiledModule, Module) { /// Compile the provided Move code into a blob which can be used as the code to be executed /// (a Script). pub fn compile_script(code: &str, mut extra_deps: Vec) -> Script { - let mut framework_modules = cached_packages::head_release_bundle().compiled_modules(); + let mut framework_modules = aptos_cached_packages::head_release_bundle().compiled_modules(); framework_modules.append(&mut extra_deps); let compiler = Compiler { deps: framework_modules.iter().collect(), diff --git a/aptos-move/e2e-tests/src/executor.rs b/aptos-move/e2e-tests/src/executor.rs index 0a7343ffa91ba..03c777711111b 100644 --- a/aptos-move/e2e-tests/src/executor.rs +++ b/aptos-move/e2e-tests/src/executor.rs @@ -21,6 +21,7 @@ use crate::{ }; use aptos_bitvec::BitVec; use aptos_crypto::HashValue; +use aptos_framework::ReleaseBundle; use aptos_gas::{AbstractValueSizeGasParameters, NativeGasParameters, LATEST_GAS_FEATURE_VERSION}; use aptos_keygen::KeyGen; use aptos_state_view::StateView; @@ -48,7 +49,6 @@ use aptos_vm::{ move_vm_ext::{MoveVmExt, SessionId}, AptosVM, VMExecutor, VMValidator, }; -use framework::ReleaseBundle; use move_core_types::{ account_address::AccountAddress, identifier::Identifier, @@ -211,7 +211,9 @@ impl FakeExecutor { /// initialization done. pub fn stdlib_only_genesis() -> Self { let mut genesis = Self::no_genesis(); - for (bytes, module) in cached_packages::head_release_bundle().code_and_compiled_modules() { + for (bytes, module) in + aptos_cached_packages::head_release_bundle().code_and_compiled_modules() + { let id = module.self_id(); genesis.add_module(&id, bytes.to_vec()); } diff --git a/aptos-move/e2e-tests/src/on_chain_configs.rs b/aptos-move/e2e-tests/src/on_chain_configs.rs index 9a11d83e457a4..d24ff941781b1 100644 --- a/aptos-move/e2e-tests/src/on_chain_configs.rs +++ b/aptos-move/e2e-tests/src/on_chain_configs.rs @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 use crate::{account::Account, executor::FakeExecutor}; +use aptos_cached_packages::aptos_stdlib; use aptos_types::{account_config::CORE_CODE_ADDRESS, on_chain_config::Version}; use aptos_vm::AptosVM; -use cached_packages::aptos_stdlib; pub fn set_aptos_version(executor: &mut FakeExecutor, version: Version) { let account = Account::new_genesis_account(CORE_CODE_ADDRESS); diff --git a/aptos-move/e2e-testsuite/Cargo.toml b/aptos-move/e2e-testsuite/Cargo.toml index 190251477101e..31c4756af14ad 100644 --- a/aptos-move/e2e-testsuite/Cargo.toml +++ b/aptos-move/e2e-testsuite/Cargo.toml @@ -14,7 +14,9 @@ rust-version = { workspace = true } [dependencies] aptos-block-executor = { workspace = true } +aptos-cached-packages = { workspace = true } aptos-crypto = { workspace = true } +aptos-framework = { workspace = true } aptos-gas = { workspace = true, features = ["testing"] } aptos-keygen = { workspace = true } aptos-logger = { workspace = true } @@ -23,8 +25,6 @@ aptos-types = { workspace = true } aptos-vm = { workspace = true } aptos-writeset-generator = { workspace = true } bcs = { workspace = true } -cached-packages ={ workspace = true } -framework = { workspace = true } itertools = { workspace = true } language-e2e-tests = { workspace = true } move-binary-format = { workspace = true } @@ -36,4 +36,4 @@ serde = { workspace = true } vm-genesis = { workspace = true } [features] -default = ["cached-packages/fuzzing"] +default = ["aptos-cached-packages/fuzzing"] diff --git a/aptos-move/e2e-testsuite/src/tests/data_store.rs b/aptos-move/e2e-testsuite/src/tests/data_store.rs index c7b9a4aa16ace..dd8aecff0b90f 100644 --- a/aptos-move/e2e-testsuite/src/tests/data_store.rs +++ b/aptos-move/e2e-testsuite/src/tests/data_store.rs @@ -247,7 +247,7 @@ fn add_module_txn(sender: &AccountData, seq_num: u64) -> (CompiledModule, Signed sender.address(), ); - let framework_modules = cached_packages::head_release_bundle().compiled_modules(); + let framework_modules = aptos_cached_packages::head_release_bundle().compiled_modules(); let compiler = Compiler { deps: framework_modules.iter().collect(), }; diff --git a/aptos-move/e2e-testsuite/src/tests/mint.rs b/aptos-move/e2e-testsuite/src/tests/mint.rs index 6e1369ec8fcee..1cbf33613c8b9 100644 --- a/aptos-move/e2e-testsuite/src/tests/mint.rs +++ b/aptos-move/e2e-testsuite/src/tests/mint.rs @@ -1,8 +1,8 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 +use aptos_cached_packages::aptos_stdlib; use aptos_types::transaction::{ExecutionStatus, TransactionStatus}; -use cached_packages::aptos_stdlib; use language_e2e_tests::{account::Account, executor::FakeExecutor}; #[test] diff --git a/aptos-move/e2e-testsuite/src/tests/on_chain_configs.rs b/aptos-move/e2e-testsuite/src/tests/on_chain_configs.rs index f84a4d8c83dca..65b5ad4ae71de 100644 --- a/aptos-move/e2e-testsuite/src/tests/on_chain_configs.rs +++ b/aptos-move/e2e-testsuite/src/tests/on_chain_configs.rs @@ -1,11 +1,11 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 +use aptos_cached_packages::aptos_stdlib; use aptos_types::{ account_config::CORE_CODE_ADDRESS, on_chain_config::Version, transaction::TransactionStatus, }; use aptos_vm::AptosVM; -use cached_packages::aptos_stdlib; use language_e2e_tests::{common_transactions::peer_to_peer_txn, executor::FakeExecutor}; #[test] diff --git a/aptos-move/e2e-testsuite/src/tests/transaction_fuzzer.rs b/aptos-move/e2e-testsuite/src/tests/transaction_fuzzer.rs index f1fabaf45399f..499a99a890085 100644 --- a/aptos-move/e2e-testsuite/src/tests/transaction_fuzzer.rs +++ b/aptos-move/e2e-testsuite/src/tests/transaction_fuzzer.rs @@ -1,7 +1,7 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 -use cached_packages::aptos_stdlib::EntryFunctionCall; +use aptos_cached_packages::aptos_stdlib::EntryFunctionCall; use language_e2e_tests::{account::Account, executor::FakeExecutor}; use proptest::{collection::vec, prelude::*}; diff --git a/aptos-move/e2e-testsuite/src/tests/verify_txn.rs b/aptos-move/e2e-testsuite/src/tests/verify_txn.rs index 71089cac58446..9d5c153e3e0a4 100644 --- a/aptos-move/e2e-testsuite/src/tests/verify_txn.rs +++ b/aptos-move/e2e-testsuite/src/tests/verify_txn.rs @@ -1,6 +1,7 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 +use aptos_cached_packages::aptos_stdlib; use aptos_crypto::{ed25519::Ed25519PrivateKey, PrivateKey, Uniform}; use aptos_gas::{InitialGasSchedule, TransactionGasParameters}; use aptos_types::{ @@ -11,7 +12,6 @@ use aptos_types::{ transaction::{ExecutionStatus, Script, TransactionArgument, TransactionStatus}, vm_status::StatusCode, }; -use cached_packages::aptos_stdlib; use language_e2e_tests::{ assert_prologue_disparity, assert_prologue_parity, common_transactions::EMPTY_SCRIPT, compile::compile_module, current_function_name, executor::FakeExecutor, transaction_status_eq, @@ -672,7 +672,7 @@ fn good_module_uses_bad( address, ); - let framework_modules = cached_packages::head_release_bundle().compiled_modules(); + let framework_modules = aptos_cached_packages::head_release_bundle().compiled_modules(); let compiler = Compiler { deps: framework_modules .iter() diff --git a/aptos-move/framework/Cargo.toml b/aptos-move/framework/Cargo.toml index 97c3d51129943..d7e59f9c60c10 100644 --- a/aptos-move/framework/Cargo.toml +++ b/aptos-move/framework/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "framework" +name = "aptos-framework" description = "Aptos stdlib" version = "0.1.0" @@ -16,6 +16,7 @@ rust-version = { workspace = true } anyhow = { workspace = true } aptos-aggregator = { workspace = true } aptos-crypto = { workspace = true, features = ["fuzzing"] } +aptos-gas-algebra-ext = { workspace = true } aptos-module-verifier = { workspace = true } aptos-sdk-builder = { workspace = true } aptos-state-view = { workspace = true } @@ -27,7 +28,6 @@ clap = { workspace = true } codespan-reporting = { workspace = true } curve25519-dalek = { workspace = true } flate2 = { workspace = true } -gas-algebra-ext = { workspace = true } include_dir = { workspace = true } itertools = { workspace = true } libsecp256k1 = { workspace = true } @@ -63,9 +63,9 @@ tempfile = { workspace = true } tiny-keccak = { workspace = true } [dev-dependencies] +aptos-cached-packages = { workspace = true } aptos-gas = { workspace = true } aptos-vm = { workspace = true, features = ["testing"] } -cached-packages = { workspace = true } claims = { workspace = true } move-cli = { workspace = true } move-prover = { workspace = true } diff --git a/aptos-move/framework/aptos-framework/doc/aggregator.md b/aptos-move/framework/aptos-framework/doc/aggregator.md index 1aad7e8d1725e..63a8940bbd1ad 100644 --- a/aptos-move/framework/aptos-framework/doc/aggregator.md +++ b/aptos-move/framework/aptos-framework/doc/aggregator.md @@ -234,7 +234,7 @@ Destroys an aggregator and removes it from its AggregatorFactory. -
pragma verify = false;
+
pragma verify = true;
 
@@ -251,6 +251,7 @@ Destroys an aggregator and removes it from its AggregatorFactory.
pragma opaque;
+aborts_if !spec_aggreator_exists(aggregator);
 
@@ -267,6 +268,7 @@ Destroys an aggregator and removes it from its AggregatorFactory.
pragma opaque;
+aborts_if !spec_aggreator_exists(aggregator);
 
@@ -283,6 +285,7 @@ Destroys an aggregator and removes it from its AggregatorFactory.
pragma opaque;
+aborts_if !spec_aggreator_exists(aggregator);
 
@@ -299,6 +302,16 @@ Destroys an aggregator and removes it from its AggregatorFactory.
pragma opaque;
+aborts_if false;
+
+ + + + + + + +
fun spec_aggreator_exists(aggregator: Aggregator): bool;
 
diff --git a/aptos-move/framework/aptos-framework/doc/aggregator_factory.md b/aptos-move/framework/aptos-framework/doc/aggregator_factory.md index e59707d642601..7344f2f0e5918 100644 --- a/aptos-move/framework/aptos-framework/doc/aggregator_factory.md +++ b/aptos-move/framework/aptos-framework/doc/aggregator_factory.md @@ -17,6 +17,9 @@ can be enabled for the public. - [Function `create_aggregator`](#0x1_aggregator_factory_create_aggregator) - [Function `new_aggregator`](#0x1_aggregator_factory_new_aggregator) - [Specification](#@Specification_1) + - [Function `initialize_aggregator_factory`](#@Specification_1_initialize_aggregator_factory) + - [Function `create_aggregator_internal`](#@Specification_1_create_aggregator_internal) + - [Function `create_aggregator`](#@Specification_1_create_aggregator) - [Function `new_aggregator`](#@Specification_1_new_aggregator) @@ -190,7 +193,65 @@ Returns a new aggregator. -
pragma verify = false;
+
pragma verify = true;
+pragma aborts_if_is_strict;
+
+ + + + + +### Function `initialize_aggregator_factory` + + +
public(friend) fun initialize_aggregator_factory(aptos_framework: &signer)
+
+ + +Make sure the caller is @aptos_framework. +AggregatorFactory is not under the caller before creating the resource. + + +
let addr = signer::address_of(aptos_framework);
+aborts_if addr != @aptos_framework;
+aborts_if exists<AggregatorFactory>(addr);
+ensures exists<AggregatorFactory>(addr);
+
+ + + + + +### Function `create_aggregator_internal` + + +
public(friend) fun create_aggregator_internal(limit: u128): aggregator::Aggregator
+
+ + + + +
aborts_if !exists<AggregatorFactory>(@aptos_framework);
+
+ + + + + +### Function `create_aggregator` + + +
public fun create_aggregator(account: &signer, limit: u128): aggregator::Aggregator
+
+ + +Make sure the caller is @aptos_framework. +AggregatorFactory existed under the @aptos_framework when Creating a new aggregator. + + +
let addr = signer::address_of(account);
+aborts_if addr != @aptos_framework;
+aborts_if !exists<AggregatorFactory>(@aptos_framework);
 
diff --git a/aptos-move/framework/aptos-framework/doc/event.md b/aptos-move/framework/aptos-framework/doc/event.md index 4d8f95f9278fa..c4200497437d4 100644 --- a/aptos-move/framework/aptos-framework/doc/event.md +++ b/aptos-move/framework/aptos-framework/doc/event.md @@ -18,6 +18,7 @@ events emitted to a handle and emit events to the event store. - [Function `destroy_handle`](#0x1_event_destroy_handle) - [Specification](#@Specification_0) - [Function `emit_event`](#@Specification_0_emit_event) + - [Function `write_to_event_store`](#@Specification_0_write_to_event_store)
use 0x1::bcs;
@@ -222,6 +223,13 @@ Destroy a unique handle.
 ## Specification
 
 
+
+
pragma verify = true;
+pragma aborts_if_is_strict;
+
+ + + ### Function `emit_event` @@ -239,8 +247,19 @@ Destroy a unique handle. + + +### Function `write_to_event_store` + + +
fun write_to_event_store<T: drop, store>(guid: vector<u8>, count: u64, msg: T)
+
+ + +Native function use opaque. + -
pragma verify = false;
+
pragma opaque;
 
diff --git a/aptos-move/framework/aptos-framework/doc/guid.md b/aptos-move/framework/aptos-framework/doc/guid.md index 45886815e1fbc..83efde6695858 100644 --- a/aptos-move/framework/aptos-framework/doc/guid.md +++ b/aptos-move/framework/aptos-framework/doc/guid.md @@ -17,6 +17,8 @@ A module for generating globally unique identifiers - [Function `creation_num`](#0x1_guid_creation_num) - [Function `id_creation_num`](#0x1_guid_id_creation_num) - [Function `eq_id`](#0x1_guid_eq_id) +- [Specification](#@Specification_1) + - [Function `create`](#@Specification_1_create)
@@ -307,5 +309,32 @@ Return true if the GUID's ID is id + + +## Specification + + + +
pragma verify = true;
+pragma aborts_if_is_strict;
+
+ + + + + +### Function `create` + + +
public(friend) fun create(addr: address, creation_num_ref: &mut u64): guid::GUID
+
+ + + + +
aborts_if creation_num_ref + 1 > MAX_U64;
+ensures result.id.creation_num == old(creation_num_ref);
+
+ [move-book]: https://move-language.github.io/move/introduction.html diff --git a/aptos-move/framework/aptos-framework/doc/optional_aggregator.md b/aptos-move/framework/aptos-framework/doc/optional_aggregator.md index c59bd32b79ef7..454732a27a93d 100644 --- a/aptos-move/framework/aptos-framework/doc/optional_aggregator.md +++ b/aptos-move/framework/aptos-framework/doc/optional_aggregator.md @@ -29,6 +29,19 @@ aggregator (parallelizable) or via normal integers. - [Function `read`](#0x1_optional_aggregator_read) - [Function `is_parallelizable`](#0x1_optional_aggregator_is_parallelizable) - [Specification](#@Specification_1) + - [Function `add_integer`](#@Specification_1_add_integer) + - [Function `sub_integer`](#@Specification_1_sub_integer) + - [Function `new`](#@Specification_1_new) + - [Function `switch`](#@Specification_1_switch) + - [Function `switch_and_zero_out`](#@Specification_1_switch_and_zero_out) + - [Function `switch_to_integer_and_zero_out`](#@Specification_1_switch_to_integer_and_zero_out) + - [Function `switch_to_aggregator_and_zero_out`](#@Specification_1_switch_to_aggregator_and_zero_out) + - [Function `destroy`](#@Specification_1_destroy) + - [Function `destroy_optional_aggregator`](#@Specification_1_destroy_optional_aggregator) + - [Function `destroy_optional_integer`](#@Specification_1_destroy_optional_integer) + - [Function `add`](#@Specification_1_add) + - [Function `sub`](#@Specification_1_sub) + - [Function `read`](#@Specification_1_read)
use 0x1::aggregator;
@@ -659,6 +672,236 @@ Returns true if optional aggregator uses parallelizable implementation.
 
 
 
+
pragma verify = true;
+pragma aborts_if_is_strict;
+
+ + + + + +### Function `add_integer` + + +
fun add_integer(integer: &mut optional_aggregator::Integer, value: u128)
+
+ + +Check for overflow. + + +
aborts_if value > (integer.limit - integer.value);
+aborts_if integer.value + value > MAX_U128;
+ensures integer.value == old(integer.value) + value;
+
+ + + + + +### Function `sub_integer` + + +
fun sub_integer(integer: &mut optional_aggregator::Integer, value: u128)
+
+ + + + +
aborts_if value > integer.value;
+ensures integer.value == old(integer.value) - value;
+
+ + + + + +### Function `new` + + +
public(friend) fun new(limit: u128, parallelizable: bool): optional_aggregator::OptionalAggregator
+
+ + + + +
aborts_if parallelizable && !exists<aggregator_factory::AggregatorFactory>(@aptos_framework);
+
+ + + + + +### Function `switch` + + +
public fun switch(optional_aggregator: &mut optional_aggregator::OptionalAggregator)
+
+ + + + +
pragma verify = false;
+
+ + + + + +### Function `switch_and_zero_out` + + +
fun switch_and_zero_out(optional_aggregator: &mut optional_aggregator::OptionalAggregator)
+
+ + +Option does not exist When Option exists. +Option exists when Option does not exist. +The AggregatorFactory is under the @aptos_framework when Option does not exist. + + +
let vec_ref = optional_aggregator.integer.vec;
+aborts_if is_parallelizable(optional_aggregator) && len(vec_ref) != 0;
+aborts_if !is_parallelizable(optional_aggregator) && len(vec_ref) == 0;
+aborts_if !is_parallelizable(optional_aggregator) && !exists<aggregator_factory::AggregatorFactory>(@aptos_framework);
+
+ + + + + +### Function `switch_to_integer_and_zero_out` + + +
fun switch_to_integer_and_zero_out(optional_aggregator: &mut optional_aggregator::OptionalAggregator): u128
+
+ + +The aggregator exists and the integer dosex not exist when Switches from parallelizable to non-parallelizable implementation. + + +
aborts_if len(optional_aggregator.aggregator.vec) == 0;
+aborts_if len(optional_aggregator.integer.vec) != 0;
+
+ + + + + +### Function `switch_to_aggregator_and_zero_out` + + +
fun switch_to_aggregator_and_zero_out(optional_aggregator: &mut optional_aggregator::OptionalAggregator): u128
+
+ + +The integer exists and the aggregator does not exist when Switches from non-parallelizable to parallelizable implementation. +The AggregatorFactory is under the @aptos_framework. + + +
aborts_if len(optional_aggregator.integer.vec) == 0;
+aborts_if !exists<aggregator_factory::AggregatorFactory>(@aptos_framework);
+aborts_if len(optional_aggregator.aggregator.vec) != 0;
+
+ + + + + +### Function `destroy` + + +
public fun destroy(optional_aggregator: optional_aggregator::OptionalAggregator)
+
+ + + + +
aborts_if is_parallelizable(optional_aggregator) && len(optional_aggregator.integer.vec) != 0;
+aborts_if !is_parallelizable(optional_aggregator) && len(optional_aggregator.integer.vec) == 0;
+
+ + + + + +### Function `destroy_optional_aggregator` + + +
fun destroy_optional_aggregator(optional_aggregator: optional_aggregator::OptionalAggregator): u128
+
+ + +The aggregator exists and the integer does not exist when destroy the aggregator. + + +
aborts_if len(optional_aggregator.aggregator.vec) == 0;
+aborts_if len(optional_aggregator.integer.vec) != 0;
+
+ + + + + +### Function `destroy_optional_integer` + + +
fun destroy_optional_integer(optional_aggregator: optional_aggregator::OptionalAggregator): u128
+
+ + +The integer exists and the aggregator does not exist when destroy the integer. + + +
aborts_if len(optional_aggregator.integer.vec) == 0;
+aborts_if len(optional_aggregator.aggregator.vec) != 0;
+
+ + + + + +### Function `add` + + +
public fun add(optional_aggregator: &mut optional_aggregator::OptionalAggregator, value: u128)
+
+ + + + +
pragma verify = false;
+
+ + + + + +### Function `sub` + + +
public fun sub(optional_aggregator: &mut optional_aggregator::OptionalAggregator, value: u128)
+
+ + + + +
pragma verify = false;
+
+ + + + + +### Function `read` + + +
public fun read(optional_aggregator: &optional_aggregator::OptionalAggregator): u128
+
+ + + +
pragma verify = false;
 
diff --git a/aptos-move/framework/aptos-framework/doc/staking_config.md b/aptos-move/framework/aptos-framework/doc/staking_config.md index 79e9a1a8a4584..5f9d06f8c9660 100644 --- a/aptos-move/framework/aptos-framework/doc/staking_config.md +++ b/aptos-move/framework/aptos-framework/doc/staking_config.md @@ -22,6 +22,13 @@ Provides the configuration for staking and rewards - [Function `validate_required_stake`](#0x1_staking_config_validate_required_stake) - [Specification](#@Specification_1) - [Resource `StakingConfig`](#@Specification_1_StakingConfig) + - [Function `initialize`](#@Specification_1_initialize) + - [Function `get`](#@Specification_1_get) + - [Function `update_required_stake`](#@Specification_1_update_required_stake) + - [Function `update_recurring_lockup_duration_secs`](#@Specification_1_update_recurring_lockup_duration_secs) + - [Function `update_rewards_rate`](#@Specification_1_update_rewards_rate) + - [Function `update_voting_power_increase_limit`](#@Specification_1_update_voting_power_increase_limit) + - [Function `validate_required_stake`](#@Specification_1_validate_required_stake)
use 0x1::error;
@@ -554,6 +561,8 @@ Can only be called as part of the Aptos governance proposal process established
 
 
 
invariant chain_status::is_operating() ==> exists<StakingConfig>(@aptos_framework);
+pragma verify = ture;
+pragma aborts_if_is_strict;
 
@@ -621,4 +630,160 @@ Can only be called as part of the Aptos governance proposal process established
+ + + +### Function `initialize` + + +
public(friend) fun initialize(aptos_framework: &signer, minimum_stake: u64, maximum_stake: u64, recurring_lockup_duration_secs: u64, allow_validator_set_change: bool, rewards_rate: u64, rewards_rate_denominator: u64, voting_power_increase_limit: u64)
+
+ + +Caller must be @aptos_framework. +The maximum_stake must be greater than maximum_stake in the range of Specified stake and the maximum_stake greater than zero. +The rewards_rate_denominator must greater than zero. +Only this %0-%50 of current total voting power is allowed to join the validator set in each epoch. +The rewards_rate which is the numerator is limited to be <= MAX_REWARDS_RATE in order to avoid the arithmetic overflow in the rewards calculation. +rewards_rate/rewards_rate_denominator <= 1. +StakingConfig does not exist under the aptos_framework before creating it. + + +
let addr = signer::address_of(aptos_framework);
+aborts_if addr != @aptos_framework;
+aborts_if minimum_stake > maximum_stake || maximum_stake <= 0;
+aborts_if recurring_lockup_duration_secs <= 0;
+aborts_if rewards_rate_denominator <= 0;
+aborts_if voting_power_increase_limit <= 0 || voting_power_increase_limit > 50;
+aborts_if rewards_rate > MAX_REWARDS_RATE;
+aborts_if rewards_rate > rewards_rate_denominator;
+aborts_if exists<StakingConfig>(addr);
+
+ + + + + +### Function `get` + + +
public fun get(): staking_config::StakingConfig
+
+ + + + +
aborts_if !exists<StakingConfig>(@aptos_framework);
+
+ + + + + +### Function `update_required_stake` + + +
public fun update_required_stake(aptos_framework: &signer, minimum_stake: u64, maximum_stake: u64)
+
+ + +Caller must be @aptos_framework. +The maximum_stake must be greater than maximum_stake in the range of Specified stake and the maximum_stake greater than zero. +The StakingConfig is under @aptos_framework. + + +
let addr = signer::address_of(aptos_framework);
+aborts_if addr != @aptos_framework;
+aborts_if minimum_stake > maximum_stake || maximum_stake <= 0;
+aborts_if !exists<StakingConfig>(@aptos_framework);
+
+ + + + + +### Function `update_recurring_lockup_duration_secs` + + +
public fun update_recurring_lockup_duration_secs(aptos_framework: &signer, new_recurring_lockup_duration_secs: u64)
+
+ + +Caller must be @aptos_framework. +The new_recurring_lockup_duration_secs must greater than zero. +The StakingConfig is under @aptos_framework. + + +
let addr = signer::address_of(aptos_framework);
+aborts_if addr != @aptos_framework;
+aborts_if new_recurring_lockup_duration_secs <= 0;
+aborts_if !exists<StakingConfig>(@aptos_framework);
+
+ + + + + +### Function `update_rewards_rate` + + +
public fun update_rewards_rate(aptos_framework: &signer, new_rewards_rate: u64, new_rewards_rate_denominator: u64)
+
+ + +Caller must be @aptos_framework. +The new_rewards_rate_denominator must greater than zero. +The StakingConfig is under @aptos_framework. +The rewards_rate which is the numerator is limited to be <= MAX_REWARDS_RATE in order to avoid the arithmetic overflow in the rewards calculation. +rewards_rate/rewards_rate_denominator <= 1. + + +
let addr = signer::address_of(aptos_framework);
+aborts_if addr != @aptos_framework;
+aborts_if new_rewards_rate_denominator <= 0;
+aborts_if !exists<StakingConfig>(@aptos_framework);
+aborts_if new_rewards_rate > MAX_REWARDS_RATE;
+aborts_if new_rewards_rate > new_rewards_rate_denominator;
+
+ + + + + +### Function `update_voting_power_increase_limit` + + +
public fun update_voting_power_increase_limit(aptos_framework: &signer, new_voting_power_increase_limit: u64)
+
+ + +Caller must be @aptos_framework. +Only this %0-%50 of current total voting power is allowed to join the validator set in each epoch. +The StakingConfig is under @aptos_framework. + + +
let addr = signer::address_of(aptos_framework);
+aborts_if addr != @aptos_framework;
+aborts_if new_voting_power_increase_limit <= 0 || new_voting_power_increase_limit > 50;
+aborts_if !exists<StakingConfig>(@aptos_framework);
+
+ + + + + +### Function `validate_required_stake` + + +
fun validate_required_stake(minimum_stake: u64, maximum_stake: u64)
+
+ + +The maximum_stake must be greater than maximum_stake in the range of Specified stake and the maximum_stake greater than zero. + + +
aborts_if minimum_stake > maximum_stake || maximum_stake <= 0;
+
+ + [move-book]: https://move-language.github.io/move/introduction.html diff --git a/aptos-move/framework/aptos-framework/doc/version.md b/aptos-move/framework/aptos-framework/doc/version.md index 5b4f03e594bb1..23d2476c322c4 100644 --- a/aptos-move/framework/aptos-framework/doc/version.md +++ b/aptos-move/framework/aptos-framework/doc/version.md @@ -13,7 +13,9 @@ Maintains the version number for the blockchain. - [Function `set_version`](#0x1_version_set_version) - [Function `initialize_for_test`](#0x1_version_initialize_for_test) - [Specification](#@Specification_1) + - [Function `initialize`](#@Specification_1_initialize) - [Function `set_version`](#@Specification_1_set_version) + - [Function `initialize_for_test`](#@Specification_1_initialize_for_test)
use 0x1::error;
@@ -201,6 +203,32 @@ to update the version.
 ## Specification
 
 
+
+
pragma verify = true;
+pragma aborts_if_is_strict;
+
+ + + + + +### Function `initialize` + + +
public(friend) fun initialize(aptos_framework: &signer, initial_version: u64)
+
+ + +Abort if resource already exists in @aptos_framwork when initializing. + + +
aborts_if signer::address_of(aptos_framework) != @aptos_framework;
+aborts_if exists<Version>(@aptos_framework);
+aborts_if exists<SetVersionCapability>(@aptos_framework);
+
+ + + ### Function `set_version` @@ -217,4 +245,30 @@ to update the version.
+ + +
aborts_if !exists<SetVersionCapability>(signer::address_of(account));
+aborts_if !exists<Version>(@aptos_framework);
+let old_major = global<Version>(@aptos_framework).major;
+aborts_if !(old_major < major);
+
+ + + + + +### Function `initialize_for_test` + + +
fun initialize_for_test(core_resources: &signer)
+
+ + +This module turns on aborts_if_is_strict, so need to add spec for test function initialize_for_test. + + +
pragma verify = false;
+
+ + [move-book]: https://move-language.github.io/move/introduction.html diff --git a/aptos-move/framework/aptos-framework/doc/voting.md b/aptos-move/framework/aptos-framework/doc/voting.md index 74cdfaf2021c0..f92be497e9c45 100644 --- a/aptos-move/framework/aptos-framework/doc/voting.md +++ b/aptos-move/framework/aptos-framework/doc/voting.md @@ -107,8 +107,9 @@ Extra metadata (e.g. description, code url) can be part of the ProposalType stru Currently, we have three attributes that are used by the voting flow. 1. RESOLVABLE_TIME_METADATA_KEY: this is uesed to record the resolvable time to ensure that resolution has to be done non-atomically. 2. IS_MULTI_STEP_PROPOSAL_KEY: this is used to track if a proposal is single-step or multi-step. - 3. IS_MULTI_STEP_PROPOSAL_IN_EXECUTION_KEY: this attribute only exists for and applies to multi-step proposals. The value is used to - indicate if a multi-step proposal is in execution. If yes, we will disable further voting for this multi-step proposal. + 3. IS_MULTI_STEP_PROPOSAL_IN_EXECUTION_KEY: this attribute only applies to multi-step proposals. A single-step proposal will not have + this field in its metadata map. The value is used to indicate if a multi-step proposal is in execution. If yes, we will disable further + voting for this multi-step proposal.
creation_time_secs: u64 @@ -889,6 +890,7 @@ This guarantees that voting eligibility and voting power are controlled by the r ## Function `is_proposal_resolvable` +Common checks on if a proposal is resolvable, regardless if the proposal is single-step or multi-step.
fun is_proposal_resolvable<ProposalType: store>(voting_forum_address: address, proposal_id: u64)
@@ -1019,6 +1021,7 @@ there are more yes votes than no. If either of these conditions is not met, this
     let voting_forum = borrow_global_mut<VotingForum<ProposalType>>(voting_forum_address);
     let proposal = table::borrow_mut(&mut voting_forum.proposals, proposal_id);
 
+    // Update the IS_MULTI_STEP_PROPOSAL_IN_EXECUTION_KEY key to indicate that the multi-step proposal is in execution.
     let multi_step_in_execution_key = utf8(IS_MULTI_STEP_PROPOSAL_IN_EXECUTION_KEY);
     if (simple_map::contains_key(&proposal.metadata, &multi_step_in_execution_key)) {
         let is_multi_step_proposal_in_execution_value = simple_map::borrow_mut(&mut proposal.metadata, &multi_step_in_execution_key);
diff --git a/aptos-move/framework/aptos-framework/sources/aggregator/aggregator.spec.move b/aptos-move/framework/aptos-framework/sources/aggregator/aggregator.spec.move
index ea623cc722d54..8121777749d37 100644
--- a/aptos-move/framework/aptos-framework/sources/aggregator/aggregator.spec.move
+++ b/aptos-move/framework/aptos-framework/sources/aggregator/aggregator.spec.move
@@ -1,25 +1,32 @@
 spec aptos_framework::aggregator {
     spec module {
-        pragma verify = false;
+        pragma verify = true;
     }
 
-    spec add {
+    spec add(aggregator: &mut Aggregator, value: u128) {
         // TODO: temporary mockup.
         pragma opaque;
+        aborts_if !spec_aggreator_exists(aggregator);
     }
 
-    spec sub {
+    spec sub(aggregator: &mut Aggregator, value: u128) {
         // TODO: temporary mockup.
         pragma opaque;
+        aborts_if !spec_aggreator_exists(aggregator);
     }
 
-    spec read {
+    spec read(aggregator: &Aggregator): u128 {
         // TODO: temporary mockup.
         pragma opaque;
+        aborts_if !spec_aggreator_exists(aggregator);
     }
 
-    spec destroy {
+    spec destroy(aggregator: Aggregator) {
         // TODO: temporary mockup.
         pragma opaque;
+        // TODO: this aborts_if condition is a temporary mockup, which needs to be refined.
+        aborts_if false;
     }
+
+    spec fun spec_aggreator_exists(aggregator: Aggregator): bool;
 }
diff --git a/aptos-move/framework/aptos-framework/sources/aggregator/aggregator_factory.spec.move b/aptos-move/framework/aptos-framework/sources/aggregator/aggregator_factory.spec.move
index 65374019855a7..8bd757db07e38 100644
--- a/aptos-move/framework/aptos-framework/sources/aggregator/aggregator_factory.spec.move
+++ b/aptos-move/framework/aptos-framework/sources/aggregator/aggregator_factory.spec.move
@@ -1,10 +1,34 @@
 spec aptos_framework::aggregator_factory {
     spec module {
-        pragma verify = false;
+        pragma verify = true;
+        pragma aborts_if_is_strict;
     }
 
     spec new_aggregator {
         // TODO: temporary mockup.
         pragma opaque;
     }
+
+    /// Make sure the caller is @aptos_framework.
+    /// AggregatorFactory is not under the caller before creating the resource.
+    spec initialize_aggregator_factory(aptos_framework: &signer) {
+        use std::signer;
+        let addr = signer::address_of(aptos_framework);
+        aborts_if addr != @aptos_framework;
+        aborts_if exists(addr);
+        ensures exists(addr);
+    }
+
+    spec create_aggregator_internal(limit: u128): Aggregator {
+        aborts_if !exists(@aptos_framework);
+    }
+
+    /// Make sure the caller is @aptos_framework.
+    /// AggregatorFactory existed under the @aptos_framework when Creating a new aggregator.
+    spec create_aggregator(account: &signer, limit: u128): Aggregator {
+        use std::signer;
+        let addr = signer::address_of(account);
+        aborts_if addr != @aptos_framework;
+        aborts_if !exists(@aptos_framework);
+    }
 }
diff --git a/aptos-move/framework/aptos-framework/sources/aggregator/optional_aggregator.spec.move b/aptos-move/framework/aptos-framework/sources/aggregator/optional_aggregator.spec.move
index 539347af2e266..c43877a9b2149 100644
--- a/aptos-move/framework/aptos-framework/sources/aggregator/optional_aggregator.spec.move
+++ b/aptos-move/framework/aptos-framework/sources/aggregator/optional_aggregator.spec.move
@@ -1,5 +1,83 @@
 spec aptos_framework::optional_aggregator {
     spec module {
+        pragma verify = true;
+        pragma aborts_if_is_strict;
+    }
+
+    /// Check for overflow.
+    spec add_integer(integer: &mut Integer, value: u128) {
+        aborts_if value > (integer.limit - integer.value);
+        aborts_if integer.value + value > MAX_U128;
+        ensures integer.value == old(integer.value) + value;
+    }
+
+    spec sub(optional_aggregator: &mut OptionalAggregator, value: u128) {
+        pragma verify = false;
+    }
+
+    spec read(optional_aggregator: &OptionalAggregator): u128 {
+        pragma verify = false;
+    }
+
+    spec add(optional_aggregator: &mut OptionalAggregator, value: u128) {
+        pragma verify = false;
+    }
+
+    spec switch(optional_aggregator: &mut OptionalAggregator) {
         pragma verify = false;
     }
+
+    spec sub_integer(integer: &mut Integer, value: u128) {
+        aborts_if value > integer.value;
+        ensures integer.value == old(integer.value) - value;
+    }
+
+    spec new(limit: u128, parallelizable: bool): OptionalAggregator {
+        aborts_if parallelizable && !exists(@aptos_framework);
+    }
+
+    /// Option does not exist When Option exists.
+    /// Option exists when Option does not exist.
+    /// The AggregatorFactory is under the @aptos_framework when Option does not exist.
+    spec switch_and_zero_out(optional_aggregator: &mut OptionalAggregator) {
+        let vec_ref = optional_aggregator.integer.vec;
+        aborts_if is_parallelizable(optional_aggregator) && len(vec_ref) != 0;
+        aborts_if !is_parallelizable(optional_aggregator) && len(vec_ref) == 0;
+        aborts_if !is_parallelizable(optional_aggregator) && !exists(@aptos_framework);
+    }
+
+    /// The aggregator exists and the integer dosex not exist when Switches from parallelizable to non-parallelizable implementation.
+    spec switch_to_integer_and_zero_out(
+        optional_aggregator: &mut OptionalAggregator
+    ): u128 {
+        aborts_if len(optional_aggregator.aggregator.vec) == 0;
+        aborts_if len(optional_aggregator.integer.vec) != 0;
+    }
+
+    /// The integer exists and the aggregator does not exist when Switches from non-parallelizable to parallelizable implementation.
+    /// The AggregatorFactory is under the @aptos_framework.
+    spec switch_to_aggregator_and_zero_out(
+        optional_aggregator: &mut OptionalAggregator
+    ): u128 {
+        aborts_if len(optional_aggregator.integer.vec) == 0;
+        aborts_if !exists(@aptos_framework);
+        aborts_if len(optional_aggregator.aggregator.vec) != 0;
+    }
+
+    spec destroy(optional_aggregator: OptionalAggregator) {
+        aborts_if is_parallelizable(optional_aggregator) && len(optional_aggregator.integer.vec) != 0;
+        aborts_if !is_parallelizable(optional_aggregator) && len(optional_aggregator.integer.vec) == 0;
+    }
+
+    /// The aggregator exists and the integer does not exist when destroy the aggregator.
+    spec destroy_optional_aggregator(optional_aggregator: OptionalAggregator): u128 {
+        aborts_if len(optional_aggregator.aggregator.vec) == 0;
+        aborts_if len(optional_aggregator.integer.vec) != 0;
+    }
+
+    /// The integer exists and the aggregator does not exist when destroy the integer.
+    spec destroy_optional_integer(optional_aggregator: OptionalAggregator): u128 {
+        aborts_if len(optional_aggregator.integer.vec) == 0;
+        aborts_if len(optional_aggregator.aggregator.vec) != 0;
+    }
 }
diff --git a/aptos-move/framework/aptos-framework/sources/configs/staking_config.spec.move b/aptos-move/framework/aptos-framework/sources/configs/staking_config.spec.move
index f0ad3e908317b..20a03c2787fe4 100644
--- a/aptos-move/framework/aptos-framework/sources/configs/staking_config.spec.move
+++ b/aptos-move/framework/aptos-framework/sources/configs/staking_config.spec.move
@@ -2,7 +2,10 @@ spec aptos_framework::staking_config {
     spec module {
         use aptos_framework::chain_status;
         invariant chain_status::is_operating() ==> exists(@aptos_framework);
+        pragma verify = ture;
+        pragma aborts_if_is_strict;
     }
+
     spec StakingConfig {
         // `rewards_rate` which is the numerator is limited to be `<= MAX_REWARDS_RATE` in order to avoid the arithmetic
         // overflow in the rewards calculation. `rewards_rate_denominator` can be adjusted to get the desired rewards
@@ -11,4 +14,104 @@ spec aptos_framework::staking_config {
         invariant rewards_rate_denominator > 0;
         invariant rewards_rate <= rewards_rate_denominator;
     }
+
+    /// Caller must be @aptos_framework.
+    /// The maximum_stake must be greater than maximum_stake in the range of Specified stake and the maximum_stake greater than zero.
+    /// The rewards_rate_denominator must greater than zero.
+    /// Only this %0-%50 of current total voting power is allowed to join the validator set in each epoch.
+    /// The `rewards_rate` which is the numerator is limited to be `<= MAX_REWARDS_RATE` in order to avoid the arithmetic overflow in the rewards calculation.
+    /// rewards_rate/rewards_rate_denominator <= 1.
+    /// StakingConfig does not exist under the aptos_framework before creating it.
+    spec initialize(
+        aptos_framework: &signer,
+        minimum_stake: u64,
+        maximum_stake: u64,
+        recurring_lockup_duration_secs: u64,
+        allow_validator_set_change: bool,
+        rewards_rate: u64,
+        rewards_rate_denominator: u64,
+        voting_power_increase_limit: u64,
+    ) {
+        use std::signer;
+        let addr = signer::address_of(aptos_framework);
+        aborts_if addr != @aptos_framework;
+        aborts_if minimum_stake > maximum_stake || maximum_stake <= 0;
+        aborts_if recurring_lockup_duration_secs <= 0;
+        aborts_if rewards_rate_denominator <= 0;
+        aborts_if voting_power_increase_limit <= 0 || voting_power_increase_limit > 50;
+        aborts_if rewards_rate > MAX_REWARDS_RATE;
+        aborts_if rewards_rate > rewards_rate_denominator;
+        aborts_if exists(addr);
+    }
+
+    spec get(): StakingConfig {
+        aborts_if !exists(@aptos_framework);
+    }
+
+    /// Caller must be @aptos_framework.
+    /// The maximum_stake must be greater than maximum_stake in the range of Specified stake and the maximum_stake greater than zero.
+    /// The StakingConfig is under @aptos_framework.
+    spec update_required_stake(
+        aptos_framework: &signer,
+        minimum_stake: u64,
+        maximum_stake: u64,
+    ) {
+        use std::signer;
+        let addr = signer::address_of(aptos_framework);
+        aborts_if addr != @aptos_framework;
+        aborts_if minimum_stake > maximum_stake || maximum_stake <= 0;
+        aborts_if !exists(@aptos_framework);
+    }
+
+    /// Caller must be @aptos_framework.
+    /// The new_recurring_lockup_duration_secs must greater than zero.
+    /// The StakingConfig is under @aptos_framework.
+    spec update_recurring_lockup_duration_secs(
+        aptos_framework: &signer,
+        new_recurring_lockup_duration_secs: u64,
+    ) {
+        use std::signer;
+        let addr = signer::address_of(aptos_framework);
+        aborts_if addr != @aptos_framework;
+        aborts_if new_recurring_lockup_duration_secs <= 0;
+        aborts_if !exists(@aptos_framework);
+    }
+
+    /// Caller must be @aptos_framework.
+    /// The new_rewards_rate_denominator must greater than zero.
+    /// The StakingConfig is under @aptos_framework.
+    /// The `rewards_rate` which is the numerator is limited to be `<= MAX_REWARDS_RATE` in order to avoid the arithmetic overflow in the rewards calculation.
+    /// rewards_rate/rewards_rate_denominator <= 1.
+    spec update_rewards_rate(
+        aptos_framework: &signer,
+        new_rewards_rate: u64,
+        new_rewards_rate_denominator: u64,
+    ) {
+        use std::signer;
+        let addr = signer::address_of(aptos_framework);
+        aborts_if addr != @aptos_framework;
+        aborts_if new_rewards_rate_denominator <= 0;
+        aborts_if !exists(@aptos_framework);
+        aborts_if new_rewards_rate > MAX_REWARDS_RATE;
+        aborts_if new_rewards_rate > new_rewards_rate_denominator;
+    }
+
+    /// Caller must be @aptos_framework.
+    /// Only this %0-%50 of current total voting power is allowed to join the validator set in each epoch.
+    /// The StakingConfig is under @aptos_framework.
+    spec update_voting_power_increase_limit(
+        aptos_framework: &signer,
+        new_voting_power_increase_limit: u64,
+    ) {
+        use std::signer;
+        let addr = signer::address_of(aptos_framework);
+        aborts_if addr != @aptos_framework;
+        aborts_if new_voting_power_increase_limit <= 0 || new_voting_power_increase_limit > 50;
+        aborts_if !exists(@aptos_framework);
+    }
+
+    /// The maximum_stake must be greater than maximum_stake in the range of Specified stake and the maximum_stake greater than zero.
+    spec validate_required_stake(minimum_stake: u64, maximum_stake: u64) {
+        aborts_if minimum_stake > maximum_stake || maximum_stake <= 0;
+    }
 }
diff --git a/aptos-move/framework/aptos-framework/sources/configs/version.spec.move b/aptos-move/framework/aptos-framework/sources/configs/version.spec.move
index f8df2d6219e6f..eff6dcb374f5e 100644
--- a/aptos-move/framework/aptos-framework/sources/configs/version.spec.move
+++ b/aptos-move/framework/aptos-framework/sources/configs/version.spec.move
@@ -1,8 +1,39 @@
 spec aptos_framework::version {
+    spec module {
+        pragma verify = true;
+        pragma aborts_if_is_strict;
+    }
+
     spec set_version {
         use aptos_framework::chain_status;
         use aptos_framework::timestamp;
+
         requires chain_status::is_operating();
         requires timestamp::spec_now_microseconds() >= reconfiguration::last_reconfiguration_time();
     }
+
+    spec set_version(account: &signer, major: u64) {
+        use std::signer;
+
+        aborts_if !exists(signer::address_of(account));
+        aborts_if !exists(@aptos_framework);
+
+        let old_major = global(@aptos_framework).major;
+        aborts_if !(old_major < major);
+    }
+
+    /// Abort if resource already exists in `@aptos_framwork` when initializing.
+    spec initialize(aptos_framework: &signer, initial_version: u64) {
+        use std::signer;
+
+        aborts_if signer::address_of(aptos_framework) != @aptos_framework;
+        aborts_if exists(@aptos_framework);
+        aborts_if exists(@aptos_framework);
+    }
+
+    /// This module turns on `aborts_if_is_strict`, so need to add spec for test function `initialize_for_test`.
+    spec initialize_for_test {
+        // Don't verify test functions.
+        pragma verify = false;
+    }
 }
diff --git a/aptos-move/framework/aptos-framework/sources/event.spec.move b/aptos-move/framework/aptos-framework/sources/event.spec.move
index a5c647a88aca3..cf66766d32cd6 100644
--- a/aptos-move/framework/aptos-framework/sources/event.spec.move
+++ b/aptos-move/framework/aptos-framework/sources/event.spec.move
@@ -1,10 +1,16 @@
 spec aptos_framework::event {
+    spec module {
+        pragma verify = true;
+        pragma aborts_if_is_strict;
+    }
+
     spec emit_event {
         pragma opaque;
         aborts_if [abstract] false;
     }
 
-    spec module {
-        pragma verify = false;
+    /// Native function use opaque.
+    spec write_to_event_store(guid: vector, count: u64, msg: T) {
+        pragma opaque;
     }
 }
diff --git a/aptos-move/framework/aptos-framework/sources/guid.spec.move b/aptos-move/framework/aptos-framework/sources/guid.spec.move
new file mode 100644
index 0000000000000..6853fc188f7c9
--- /dev/null
+++ b/aptos-move/framework/aptos-framework/sources/guid.spec.move
@@ -0,0 +1,11 @@
+spec aptos_framework::guid {
+    spec module {
+        pragma verify = true;
+        pragma aborts_if_is_strict;
+    }
+
+    spec create(addr: address, creation_num_ref: &mut u64): GUID {
+        aborts_if creation_num_ref + 1 > MAX_U64;
+        ensures result.id.creation_num == old(creation_num_ref);
+    }
+}
diff --git a/aptos-move/framework/aptos-framework/sources/timestamp.spec.move b/aptos-move/framework/aptos-framework/sources/timestamp.spec.move
index bc00a8e859fbd..64217e5c8028d 100644
--- a/aptos-move/framework/aptos-framework/sources/timestamp.spec.move
+++ b/aptos-move/framework/aptos-framework/sources/timestamp.spec.move
@@ -9,6 +9,7 @@ spec aptos_framework::timestamp {
         requires chain_status::is_operating();
         include UpdateGlobalTimeAbortsIf;
     }
+
     spec schema UpdateGlobalTimeAbortsIf {
         account: signer;
         proposer: address;
diff --git a/aptos-move/framework/artifacts-test/Cargo.toml b/aptos-move/framework/artifacts-test/Cargo.toml
deleted file mode 100644
index 2a7c04802c2a5..0000000000000
--- a/aptos-move/framework/artifacts-test/Cargo.toml
+++ /dev/null
@@ -1,22 +0,0 @@
-[package]
-name = "artifacts-test"
-description = "Artifacts test"
-version = "0.1.0"
-
-# Workspace inherited keys
-authors = { workspace = true }
-edition = { workspace = true }
-homepage = { workspace = true }
-license = { workspace = true }
-publish = { workspace = true }
-repository = { workspace = true }
-rust-version = { workspace = true }
-
-[dependencies]
-dir-diff = { workspace = true }
-framework = { workspace = true }
-fs_extra = { workspace = true }
-tempfile = { workspace = true }
-
-[lib]
-doctest = false
diff --git a/aptos-move/framework/artifacts-test/README.md b/aptos-move/framework/artifacts-test/README.md
deleted file mode 100644
index e8febc94bc783..0000000000000
--- a/aptos-move/framework/artifacts-test/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-This crate contains a single test for CI to check whether someone has pulled
-a build dependency on `cached-packages` and therefore generated
-artifacts are up-to-date. The test must be standalone in its
-own crate to ensure running it does not itself request build of
-`cached-packages`.
diff --git a/aptos-move/framework/artifacts-test/src/artifact_test.rs b/aptos-move/framework/artifacts-test/src/artifact_test.rs
deleted file mode 100644
index 40f19641e0afd..0000000000000
--- a/aptos-move/framework/artifacts-test/src/artifact_test.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) Aptos
-// SPDX-License-Identifier: Apache-2.0
-
-use framework::{BuiltPackage, ReleaseOptions, ReleaseTarget};
-use tempfile::tempdir;
-
-/// Test which ensures that generated artifacts (sdks, documentation, etc) are up-to-date.
-/// Those artifacts are updated as a side-effect when `cached-packages` is build. However,
-/// a user may have not needed to trigger building this crate. This test forces them to do so.
-#[test]
-fn artifacts_are_updated() {
-    let temp_dir = tempdir().unwrap();
-    let ReleaseOptions {
-        build_options,
-        packages,
-        ..
-    } = ReleaseTarget::Head.create_release_options(false, None);
-    for package_path in packages {
-        // Copy the package content over to tempdir.
-        let copied_path = temp_dir.path().join(package_path.file_name().unwrap());
-        fs_extra::dir::copy(
-            &package_path,
-            &copied_path,
-            &fs_extra::dir::CopyOptions {
-                copy_inside: true,
-                ..Default::default()
-            },
-        )
-        .unwrap();
-
-        // Build the copy of the package and compare the generated documentation. Because the
-        // documentation reflects the source, it is the strictest indicator whether
-        // `cached_packages` had been build and therefore things are up-to-date.
-        BuiltPackage::build(copied_path.clone(), build_options.clone()).unwrap();
-        assert!(
-            !dir_diff::is_different(package_path.join("doc"), copied_path.join("doc")).unwrap(),
-            "Artifacts generated from Move code are not up-to-date (sdk, docs, ...). Those \
-artifacts are automatically updated if you run a build step depending on them. To force a \
-build step, run `cargo build -p cached-packages`.
-"
-        )
-    }
-}
diff --git a/aptos-move/framework/artifacts-test/src/lib.rs b/aptos-move/framework/artifacts-test/src/lib.rs
deleted file mode 100644
index fea4ff5d12b83..0000000000000
--- a/aptos-move/framework/artifacts-test/src/lib.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright (c) Aptos
-// SPDX-License-Identifier: Apache-2.0
-
-#[cfg(test)]
-mod artifact_test;
diff --git a/aptos-move/framework/cached-packages/Cargo.toml b/aptos-move/framework/cached-packages/Cargo.toml
index 2906544ac99af..07c5beadd8ef4 100644
--- a/aptos-move/framework/cached-packages/Cargo.toml
+++ b/aptos-move/framework/cached-packages/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "cached-packages"
+name = "aptos-cached-packages"
 description = "Builds framework packages for caching in builds and tests"
 version = "0.1.0"
 
@@ -13,9 +13,9 @@ repository = { workspace = true }
 rust-version = { workspace = true }
 
 [dependencies]
+aptos-framework = { workspace = true }
 aptos-types = { workspace = true, features = ["fuzzing"] }
 bcs = { workspace = true }
-framework = { workspace = true }
 include_dir = { workspace = true }
 move-core-types = { workspace = true }
 once_cell = { workspace = true }
@@ -23,7 +23,7 @@ proptest = { workspace = true, optional = true }
 proptest-derive = { workspace = true, optional = true }
 
 [build-dependencies]
-framework = { workspace = true }
+aptos-framework = { workspace = true }
 
 [features]
 default = []
diff --git a/aptos-move/framework/cached-packages/build.rs b/aptos-move/framework/cached-packages/build.rs
index 8d446f282072d..acd08ceb958e0 100644
--- a/aptos-move/framework/cached-packages/build.rs
+++ b/aptos-move/framework/cached-packages/build.rs
@@ -1,7 +1,7 @@
 // Copyright (c) Aptos
 // SPDX-License-Identifier: Apache-2.0
 
-use framework::ReleaseTarget;
+use aptos_framework::ReleaseTarget;
 use std::env::current_dir;
 use std::path::PathBuf;
 
diff --git a/aptos-move/framework/cached-packages/src/lib.rs b/aptos-move/framework/cached-packages/src/lib.rs
index 36d3e42b72d59..be0b82aee3535 100644
--- a/aptos-move/framework/cached-packages/src/lib.rs
+++ b/aptos-move/framework/cached-packages/src/lib.rs
@@ -1,7 +1,7 @@
 // Copyright (c) Aptos
 // SPDX-License-Identifier: Apache-2.0
 
-use framework::ReleaseBundle;
+use aptos_framework::ReleaseBundle;
 use once_cell::sync::Lazy;
 
 pub mod aptos_framework_sdk_builder;
diff --git a/aptos-move/framework/src/main.rs b/aptos-move/framework/src/main.rs
index a5aa487c7da48..229d0b1af4f8a 100644
--- a/aptos-move/framework/src/main.rs
+++ b/aptos-move/framework/src/main.rs
@@ -3,9 +3,9 @@
 
 #![forbid(unsafe_code)]
 
+use aptos_framework::ReleaseOptions;
+use aptos_framework::ReleaseTarget;
 use clap::Parser;
-use framework::ReleaseOptions;
-use framework::ReleaseTarget;
 
 #[derive(Parser)]
 #[clap(name = "aptos-framework", author, version, propagate_version = true)]
diff --git a/aptos-move/framework/src/natives/event.rs b/aptos-move/framework/src/natives/event.rs
index 034a02ddae86d..7d6c8b5bf259b 100644
--- a/aptos-move/framework/src/natives/event.rs
+++ b/aptos-move/framework/src/natives/event.rs
@@ -2,7 +2,7 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::natives::helpers::make_module_natives;
-use gas_algebra_ext::{AbstractValueSize, InternalGasPerAbstractValueUnit};
+use aptos_gas_algebra_ext::{AbstractValueSize, InternalGasPerAbstractValueUnit};
 use move_binary_format::errors::PartialVMResult;
 use move_core_types::gas_algebra::InternalGas;
 use move_vm_runtime::native_functions::{NativeContext, NativeFunction};
diff --git a/aptos-move/framework/src/natives/mod.rs b/aptos-move/framework/src/natives/mod.rs
index fe7b0e5335b01..53fe1b314cfec 100644
--- a/aptos-move/framework/src/natives/mod.rs
+++ b/aptos-move/framework/src/natives/mod.rs
@@ -16,8 +16,8 @@ pub mod util;
 
 use crate::natives::cryptography::multi_ed25519;
 use aggregator_natives::{aggregator, aggregator_factory};
+use aptos_gas_algebra_ext::AbstractValueSize;
 use cryptography::ed25519;
-use gas_algebra_ext::AbstractValueSize;
 
 use move_core_types::{account_address::AccountAddress, identifier::Identifier};
 use move_vm_runtime::native_functions::{make_table_from_iter, NativeFunctionTable};
diff --git a/aptos-move/framework/tests/move_prover_tests.rs b/aptos-move/framework/tests/move_prover_tests.rs
index cd00df67e2534..e1f4e262fae92 100644
--- a/aptos-move/framework/tests/move_prover_tests.rs
+++ b/aptos-move/framework/tests/move_prover_tests.rs
@@ -1,7 +1,7 @@
 // Copyright (c) Aptos
 // SPDX-License-Identifier: Apache-2.0
 
-use framework::prover::ProverOptions;
+use aptos_framework::prover::ProverOptions;
 use std::collections::BTreeMap;
 use std::path::PathBuf;
 
diff --git a/aptos-move/framework/tests/move_unit_test.rs b/aptos-move/framework/tests/move_unit_test.rs
index 8e316d5f44992..968eefb6d6bdd 100644
--- a/aptos-move/framework/tests/move_unit_test.rs
+++ b/aptos-move/framework/tests/move_unit_test.rs
@@ -1,9 +1,9 @@
 // Copyright (c) Aptos
 // SPDX-License-Identifier: Apache-2.0
 
+use aptos_framework::path_in_crate;
 use aptos_gas::{AbstractValueSizeGasParameters, NativeGasParameters, LATEST_GAS_FEATURE_VERSION};
 use aptos_vm::natives;
-use framework::path_in_crate;
 use move_cli::base::test::{run_move_unit_tests, UnitTestResult};
 use move_unit_test::UnitTestingConfig;
 use move_vm_runtime::native_functions::NativeFunctionTable;
diff --git a/aptos-move/gas-algebra-ext/Cargo.toml b/aptos-move/gas-algebra-ext/Cargo.toml
index e8cd02f24ca47..122e5f3854805 100644
--- a/aptos-move/gas-algebra-ext/Cargo.toml
+++ b/aptos-move/gas-algebra-ext/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "gas-algebra-ext"
+name = "aptos-gas-algebra-ext"
 description = "Gas Algebra Ext"
 version = "0.0.1"
 
diff --git a/aptos-move/package-builder/Cargo.toml b/aptos-move/package-builder/Cargo.toml
index 0a013c44aff8e..041515ba51615 100644
--- a/aptos-move/package-builder/Cargo.toml
+++ b/aptos-move/package-builder/Cargo.toml
@@ -14,7 +14,7 @@ rust-version = { workspace = true }
 
 [dependencies]
 anyhow = { workspace = true }
-framework = { workspace = true }
+aptos-framework = { workspace = true }
 itertools = { workspace = true }
 move-command-line-common = { workspace = true }
 move-package = { workspace = true }
diff --git a/aptos-move/package-builder/src/lib.rs b/aptos-move/package-builder/src/lib.rs
index 05b0aceb4997b..b38de1dc0c06c 100644
--- a/aptos-move/package-builder/src/lib.rs
+++ b/aptos-move/package-builder/src/lib.rs
@@ -1,7 +1,7 @@
 // Copyright (c) Aptos
 // SPDX-License-Identifier: Apache-2.0
 
-use framework::natives::code::UpgradePolicy;
+use aptos_framework::natives::code::UpgradePolicy;
 use itertools::Itertools;
 use move_command_line_common::files::MOVE_EXTENSION;
 use move_package::compilation::package_layout::CompiledPackageLayout;
diff --git a/aptos-move/vm-genesis/Cargo.toml b/aptos-move/vm-genesis/Cargo.toml
index 88c07a178e1c3..f1b131e400b8a 100644
--- a/aptos-move/vm-genesis/Cargo.toml
+++ b/aptos-move/vm-genesis/Cargo.toml
@@ -14,14 +14,14 @@ rust-version = { workspace = true }
 
 [dependencies]
 anyhow = { workspace = true }
+aptos-cached-packages =  { workspace = true }
 aptos-crypto = { workspace = true }
+aptos-framework =  { workspace = true }
 aptos-gas = { workspace = true }
 aptos-state-view = { workspace = true }
 aptos-types = { workspace = true }
 aptos-vm = { workspace = true }
 bcs = { workspace = true }
-cached-packages =  { workspace = true }
-framework =  { workspace = true }
 move-core-types = { workspace = true }
 move-vm-types = { workspace = true }
 once_cell = { workspace = true }
diff --git a/aptos-move/vm-genesis/src/lib.rs b/aptos-move/vm-genesis/src/lib.rs
index 9180db2279be5..a848fd20f83a7 100644
--- a/aptos-move/vm-genesis/src/lib.rs
+++ b/aptos-move/vm-genesis/src/lib.rs
@@ -11,6 +11,7 @@ use aptos_crypto::{
     ed25519::{Ed25519PrivateKey, Ed25519PublicKey},
     HashValue, PrivateKey, Uniform,
 };
+use aptos_framework::{ReleaseBundle, ReleasePackage};
 use aptos_gas::{
     AbstractValueSizeGasParameters, AptosGasParameters, InitialGasSchedule, NativeGasParameters,
     ToOnChainGasSchedule, LATEST_GAS_FEATURE_VERSION,
@@ -28,7 +29,6 @@ use aptos_vm::{
     data_cache::{IntoMoveResolver, StateViewCache},
     move_vm_ext::{MoveVmExt, SessionExt, SessionId},
 };
-use framework::{ReleaseBundle, ReleasePackage};
 use move_core_types::{
     account_address::AccountAddress,
     identifier::Identifier,
@@ -641,11 +641,11 @@ pub fn generate_genesis_change_set_for_testing_with_count(
     count: u64,
 ) -> ChangeSet {
     let framework = match genesis_options {
-        GenesisOptions::Head => cached_packages::head_release_bundle(),
-        GenesisOptions::Testnet => framework::testnet_release_bundle(),
+        GenesisOptions::Head => aptos_cached_packages::head_release_bundle(),
+        GenesisOptions::Testnet => aptos_framework::testnet_release_bundle(),
         GenesisOptions::Mainnet => {
             // We don't yet have mainnet, so returning testnet here
-            framework::testnet_release_bundle()
+            aptos_framework::testnet_release_bundle()
         }
     };
 
@@ -655,10 +655,10 @@ pub fn generate_genesis_change_set_for_testing_with_count(
 /// Generate a genesis `ChangeSet` for mainnet
 pub fn generate_genesis_change_set_for_mainnet(genesis_options: GenesisOptions) -> ChangeSet {
     let framework = match genesis_options {
-        GenesisOptions::Head => cached_packages::head_release_bundle(),
-        GenesisOptions::Testnet => framework::testnet_release_bundle(),
+        GenesisOptions::Head => aptos_cached_packages::head_release_bundle(),
+        GenesisOptions::Testnet => aptos_framework::testnet_release_bundle(),
         // We don't yet have mainnet, so returning testnet here
-        GenesisOptions::Mainnet => framework::testnet_release_bundle(),
+        GenesisOptions::Mainnet => aptos_framework::testnet_release_bundle(),
     };
 
     generate_mainnet_genesis(framework, Some(1)).0
@@ -672,7 +672,7 @@ pub fn test_genesis_transaction() -> Transaction {
 pub fn test_genesis_change_set_and_validators(
     count: Option,
 ) -> (ChangeSet, Vec) {
-    generate_test_genesis(cached_packages::head_release_bundle(), count)
+    generate_test_genesis(aptos_cached_packages::head_release_bundle(), count)
 }
 
 #[derive(Debug, Clone, Serialize, Deserialize)]
@@ -850,7 +850,8 @@ pub struct ValidatorWithCommissionRate {
 pub fn test_genesis_module_publishing() {
     // create a state view for move_vm
     let mut state_view = GenesisStateView::new();
-    for (module_bytes, module) in cached_packages::head_release_bundle().code_and_compiled_modules()
+    for (module_bytes, module) in
+        aptos_cached_packages::head_release_bundle().code_and_compiled_modules()
     {
         state_view.add_module(&module.self_id(), module_bytes);
     }
@@ -866,7 +867,7 @@ pub fn test_genesis_module_publishing() {
     .unwrap();
     let id1 = HashValue::zero();
     let mut session = move_vm.new_session(&data_cache, SessionId::genesis(id1));
-    publish_framework(&mut session, cached_packages::head_release_bundle());
+    publish_framework(&mut session, aptos_cached_packages::head_release_bundle());
 }
 
 #[test]
@@ -1059,7 +1060,7 @@ pub fn test_mainnet_end_to_end() {
         &accounts,
         &employees,
         &validators,
-        cached_packages::head_release_bundle(),
+        aptos_cached_packages::head_release_bundle(),
         ChainId::mainnet(),
         &mainnet_genesis_config(),
     );
diff --git a/aptos-move/writeset-transaction-generator/Cargo.toml b/aptos-move/writeset-transaction-generator/Cargo.toml
index 5c8f810089b89..e82dcc5de98ab 100644
--- a/aptos-move/writeset-transaction-generator/Cargo.toml
+++ b/aptos-move/writeset-transaction-generator/Cargo.toml
@@ -14,15 +14,15 @@ rust-version = { workspace = true }
 
 [dependencies]
 anyhow = { workspace = true }
+aptos-cached-packages =  { workspace = true }
 aptos-crypto = { workspace = true }
 aptos-crypto-derive = { workspace = true }
+aptos-framework =  { workspace = true }
 aptos-gas = { workspace = true }
 aptos-state-view = { workspace = true }
 aptos-types = { workspace = true }
 aptos-vm = { workspace = true }
 bcs = { workspace = true }
-cached-packages =  { workspace = true }
-framework =  { workspace = true }
 handlebars = { workspace = true }
 move-command-line-common = { workspace = true }
 move-compiler = { workspace = true }
diff --git a/aptos-move/writeset-transaction-generator/src/admin_script_builder.rs b/aptos-move/writeset-transaction-generator/src/admin_script_builder.rs
index 7a5aa90c33a8a..8f1eb1a524d28 100644
--- a/aptos-move/writeset-transaction-generator/src/admin_script_builder.rs
+++ b/aptos-move/writeset-transaction-generator/src/admin_script_builder.rs
@@ -21,8 +21,10 @@ pub const SCRIPTS_DIR_PATH: &str = "templates";
 pub fn compile_script(source_file_str: String) -> Vec {
     let (_files, mut compiled_program) = Compiler::from_files(
         vec![source_file_str],
-        cached_packages::head_release_bundle().files().unwrap(),
-        framework::named_addresses().clone(),
+        aptos_cached_packages::head_release_bundle()
+            .files()
+            .unwrap(),
+        aptos_framework::named_addresses().clone(),
     )
     .set_flags(Flags::empty().set_sources_shadow_deps(false))
     .build_and_report()
diff --git a/aptos-node/Cargo.toml b/aptos-node/Cargo.toml
index 7ff38e1f0501c..7b489a293652a 100644
--- a/aptos-node/Cargo.toml
+++ b/aptos-node/Cargo.toml
@@ -15,10 +15,20 @@ rust-version = { workspace = true }
 [dependencies]
 anyhow = { workspace = true }
 aptos-api = { workspace = true }
+aptos-backup-service = { workspace = true }
 aptos-build-info = { workspace = true }
+aptos-cached-packages = { workspace = true }
 aptos-config = { workspace = true }
+aptos-consensus = { workspace = true }
+aptos-consensus-notifications = { workspace = true }
+aptos-crash-handler = { workspace = true }
 aptos-crypto = { workspace = true }
 aptos-data-client = { workspace = true }
+aptos-data-streaming-service = { workspace = true }
+aptos-event-notifications = { workspace = true }
+aptos-executor = { workspace = true }
+aptos-executor-types = { workspace = true }
+aptos-framework = { workspace = true }
 aptos-genesis = { workspace = true }
 aptos-indexer = { workspace = true, optional = true }
 aptos-infallible = { workspace = true }
@@ -32,19 +42,9 @@ aptos-time-service = { workspace = true }
 aptos-types = { workspace = true }
 aptos-vm = { workspace = true }
 aptosdb = { workspace = true }
-backup-service = { workspace = true }
 bcs = { workspace = true }
-cached-packages = { workspace = true }
 clap = { workspace = true }
-consensus = { workspace = true }
-consensus-notifications = { workspace = true }
-crash-handler = { workspace = true }
-data-streaming-service = { workspace = true }
-event-notifications = { workspace = true }
-executor = { workspace = true }
-executor-types = { workspace = true }
 fail = { workspace = true }
-framework = { workspace = true }
 futures = { workspace = true }
 hex = { workspace = true }
 inspection-service = { workspace = true }
@@ -66,6 +66,6 @@ jemallocator = { workspace = true }
 [features]
 default = []
 assert-private-keys-not-cloneable = ["aptos-crypto/assert-private-keys-not-cloneable"]
-failpoints = ["fail/failpoints", "consensus/failpoints", "executor/failpoints", "aptos-mempool/failpoints", "aptos-api/failpoints"]
+failpoints = ["fail/failpoints", "aptos-consensus/failpoints", "aptos-executor/failpoints", "aptos-mempool/failpoints", "aptos-api/failpoints"]
 indexer = ["aptos-indexer"]
 check-vm-features = []
diff --git a/aptos-node/src/lib.rs b/aptos-node/src/lib.rs
index b8ff8f1997aa3..e9d0afeaa64e0 100644
--- a/aptos-node/src/lib.rs
+++ b/aptos-node/src/lib.rs
@@ -7,6 +7,7 @@ mod log_build_information;
 
 use anyhow::{anyhow, Context};
 use aptos_api::bootstrap as bootstrap_api;
+use aptos_backup_service::start_backup_service;
 use aptos_build_info::build_information;
 use aptos_config::{
     config::{
@@ -17,7 +18,13 @@ use aptos_config::{
     network_id::NetworkId,
     utils::get_genesis_txn,
 };
+use aptos_consensus::consensus_provider::start_consensus;
+use aptos_consensus_notifications::ConsensusNotificationListener;
 use aptos_data_client::aptosnet::AptosNetDataClient;
+use aptos_data_streaming_service::{
+    streaming_client::{new_streaming_service_client_listener_pair, StreamingServiceClient},
+    streaming_service::DataStreamingService,
+};
 use aptos_infallible::RwLock;
 use aptos_logger::{prelude::*, telemetry_log_writer::TelemetryLog, Level, LoggerFilterUpdater};
 use aptos_state_view::account_with_state_view::AsAccountWithStateView;
@@ -27,19 +34,12 @@ use aptos_types::{
     on_chain_config::ON_CHAIN_CONFIG_REGISTRY, waypoint::Waypoint,
 };
 
+use aptos_event_notifications::EventSubscriptionService;
+use aptos_executor::{chunk_executor::ChunkExecutor, db_bootstrapper::maybe_bootstrap};
+use aptos_framework::ReleaseBundle;
 use aptos_vm::AptosVM;
 use aptosdb::AptosDB;
-use backup_service::start_backup_service;
 use clap::Parser;
-use consensus::consensus_provider::start_consensus;
-use consensus_notifications::ConsensusNotificationListener;
-use data_streaming_service::{
-    streaming_client::{new_streaming_service_client_listener_pair, StreamingServiceClient},
-    streaming_service::DataStreamingService,
-};
-use event_notifications::EventSubscriptionService;
-use executor::{chunk_executor::ChunkExecutor, db_bootstrapper::maybe_bootstrap};
-use framework::ReleaseBundle;
 use futures::channel::mpsc;
 use hex::FromHex;
 use log_build_information::log_build_information;
@@ -127,7 +127,7 @@ impl AptosNodeArgs {
             let genesis_framework = if let Some(path) = self.genesis_framework {
                 ReleaseBundle::read(path).unwrap()
             } else {
-                cached_packages::head_release_bundle().clone()
+                aptos_cached_packages::head_release_bundle().clone()
             };
             load_test_environment(
                 self.config,
@@ -182,7 +182,7 @@ pub fn start(
     log_file: Option,
     create_global_rayon_pool: bool,
 ) -> anyhow::Result<()> {
-    crash_handler::setup_panic_handler();
+    aptos_crash_handler::setup_panic_handler();
 
     if create_global_rayon_pool {
         rayon::ThreadPoolBuilder::new()
@@ -597,7 +597,7 @@ fn create_checkpoint_and_change_working_dir(
     .create_checkpoint(&checkpoint_dir)
     .expect("AptosDB checkpoint creation failed.");
 
-    consensus::create_checkpoint(&source_dir, &checkpoint_dir)
+    aptos_consensus::create_checkpoint(&source_dir, &checkpoint_dir)
         .expect("ConsensusDB checkpoint creation failed.");
     let state_sync_db =
         state_sync_driver::metadata_storage::PersistentMetadataStorage::new(&source_dir);
@@ -801,10 +801,10 @@ pub fn setup_environment(
                 panic!("There can be at most one validator network!");
             }
 
-            consensus_network_handles = Some(
-                network_builder
-                    .add_p2p_service(&consensus::network_interface::network_endpoint_config()),
-            );
+            consensus_network_handles =
+                Some(network_builder.add_p2p_service(
+                    &aptos_consensus::network_interface::network_endpoint_config(),
+                ));
         }
 
         let network_context = network_builder.network_context();
@@ -821,7 +821,7 @@ pub fn setup_environment(
     let (mempool_notifier, mempool_listener) =
         mempool_notifications::new_mempool_notifier_listener_pair();
     let (consensus_notifier, consensus_listener) =
-        consensus_notifications::new_consensus_notifier_listener_pair(
+        aptos_consensus_notifications::new_consensus_notifier_listener_pair(
             node_config
                 .state_sync
                 .state_sync_driver
diff --git a/consensus/Cargo.toml b/consensus/Cargo.toml
index 6692c718dee40..d8677cb25a443 100644
--- a/consensus/Cargo.toml
+++ b/consensus/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "consensus"
+name = "aptos-consensus"
 description = "Aptos consensus"
 version = "0.1.0"
 
@@ -16,7 +16,13 @@ rust-version = { workspace = true }
 anyhow = { workspace = true }
 aptos-bitvec = { workspace = true }
 aptos-config = { workspace = true }
+aptos-consensus-notifications = { workspace = true }
+aptos-consensus-types = { workspace = true }
 aptos-crypto = { workspace = true }
+aptos-event-notifications = { workspace = true }
+aptos-executor = { workspace = true }
+aptos-executor-types = { workspace = true }
+aptos-fallible = { workspace = true }
 aptos-infallible = { workspace = true }
 aptos-logger = { workspace = true }
 aptos-mempool = { workspace = true }
@@ -25,18 +31,13 @@ aptos-secure-storage = { workspace = true }
 aptos-temppath = { workspace = true }
 aptos-types = { workspace = true }
 aptos-vm = { workspace = true }
+arc-swap = { workspace = true }
 async-trait = { workspace = true }
 bcs = { workspace = true }
 byteorder = { workspace = true }
 bytes = { workspace = true }
 channel = { workspace = true }
-consensus-notifications = { workspace = true }
-consensus-types = { workspace = true }
-event-notifications = { workspace = true }
-executor = { workspace = true }
-executor-types = { workspace = true }
 fail = { workspace = true }
-fallible = { workspace = true }
 futures = { workspace = true }
 futures-channel = { workspace = true }
 itertools = { workspace = true }
@@ -57,11 +58,11 @@ tokio = { workspace = true }
 
 [dev-dependencies]
 aptos-config = { workspace = true, features = ["fuzzing"] }
+aptos-consensus-types = { workspace = true, features = ["fuzzing"] }
+aptos-executor-test-helpers = { workspace = true }
 aptos-keygen = { workspace = true }
 aptos-mempool = { workspace = true, features = ["fuzzing"] }
 claims = { workspace = true }
-consensus-types = { workspace = true, features = ["fuzzing"] }
-executor-test-helpers = { workspace = true }
 move-core-types = { workspace = true }
 network = { workspace = true, features = ["fuzzing"] }
 proptest = { workspace = true }
@@ -71,5 +72,5 @@ vm-validator = { workspace = true }
 
 [features]
 default = []
-fuzzing = ["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", "safety-rules/testing"]
 failpoints = ["fail/failpoints"]
diff --git a/consensus/consensus-types/Cargo.toml b/consensus/consensus-types/Cargo.toml
index 24a29dee1d313..f82ce4ea8ed4f 100644
--- a/consensus/consensus-types/Cargo.toml
+++ b/consensus/consensus-types/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "consensus-types"
+name = "aptos-consensus-types"
 description = "Aptos consensus types"
 version = "0.1.0"
 
@@ -17,10 +17,10 @@ anyhow = { workspace = true }
 aptos-bitvec = { workspace = true }
 aptos-crypto = { workspace = true }
 aptos-crypto-derive = { workspace = true }
+aptos-executor-types = { workspace = true }
 aptos-infallible = { workspace = true }
 aptos-types = { workspace = true }
 bcs = { workspace = true }
-executor-types = { workspace = true }
 futures = { workspace = true }
 itertools = { workspace = true }
 mirai-annotations = { workspace = true }
@@ -28,6 +28,7 @@ proptest = { workspace = true, optional = true }
 rayon = { workspace = true }
 serde = { workspace = true }
 short-hex-str = { workspace = true }
+tokio = { workspace = true }
 
 [dev-dependencies]
 aptos-types = { workspace = true, features = ["fuzzing"] }
diff --git a/consensus/consensus-types/src/block.rs b/consensus/consensus-types/src/block.rs
index ed0fc0c5e1752..66dbfc2366dc0 100644
--- a/consensus/consensus-types/src/block.rs
+++ b/consensus/consensus-types/src/block.rs
@@ -15,6 +15,7 @@ use aptos_types::{
     block_metadata::BlockMetadata,
     epoch_state::EpochState,
     ledger_info::LedgerInfo,
+    transaction::SignedTransaction,
     transaction::{Transaction, Version},
     validator_signer::ValidatorSigner,
     validator_verifier::ValidatorVerifier,
@@ -331,17 +332,15 @@ impl Block {
         Ok(())
     }
 
-    pub fn transactions_to_execute(&self, validators: &[AccountAddress]) -> Vec {
+    pub fn transactions_to_execute(
+        &self,
+        validators: &[AccountAddress],
+        txns: Vec,
+    ) -> Vec {
         once(Transaction::BlockMetadata(
             self.new_block_metadata(validators),
         ))
-        .chain(
-            self.payload()
-                .unwrap_or(&Payload::empty())
-                .clone()
-                .into_iter()
-                .map(Transaction::UserTransaction),
-        )
+        .chain(txns.into_iter().map(Transaction::UserTransaction))
         .chain(once(Transaction::StateCheckpoint(self.id)))
         .collect()
     }
diff --git a/consensus/consensus-types/src/block_data.rs b/consensus/consensus-types/src/block_data.rs
index c81995d87a54c..9bfce8d91a2a5 100644
--- a/consensus/consensus-types/src/block_data.rs
+++ b/consensus/consensus-types/src/block_data.rs
@@ -263,7 +263,7 @@ fn test_reconfiguration_suffix() {
         ),
     );
     let reconfig_suffix_block = BlockData::new_proposal(
-        Payload::empty(),
+        Payload::empty(false),
         AccountAddress::random(),
         Vec::new(),
         2,
diff --git a/consensus/consensus-types/src/block_test.rs b/consensus/consensus-types/src/block_test.rs
index fea4642f8b4a5..5605b549fae19 100644
--- a/consensus/consensus-types/src/block_test.rs
+++ b/consensus/consensus-types/src/block_test.rs
@@ -71,7 +71,7 @@ fn test_nil_block() {
         nil_block_qc.certified_block().id()
     );
     let nil_block_child = Block::new_proposal(
-        Payload::empty(),
+        Payload::empty(false),
         2,
         aptos_infallible::duration_since_epoch().as_micros() as u64,
         nil_block_qc,
@@ -90,7 +90,7 @@ fn test_block_relation() {
     // Test genesis and the next block
     let genesis_block = Block::make_genesis_block();
     let quorum_cert = certificate_for_genesis();
-    let payload = Payload::empty();
+    let payload = Payload::empty(false);
     let next_block = Block::new_proposal(
         payload.clone(),
         1,
@@ -120,7 +120,7 @@ fn test_same_qc_different_authors() {
     let signer = signers.first().unwrap();
     let genesis_qc = certificate_for_genesis();
     let round = 1;
-    let payload = Payload::empty();
+    let payload = Payload::empty(false);
     let current_timestamp = aptos_infallible::duration_since_epoch().as_micros() as u64;
     let block_round_1 = Block::new_proposal(
         payload.clone(),
@@ -182,7 +182,7 @@ fn test_block_metadata_bitvec() {
         &ledger_info,
         Block::make_genesis_block_from_ledger_info(&ledger_info).id(),
     );
-    let payload = Payload::empty();
+    let payload = Payload::empty(false);
     let start_round = 1;
     let start_timestamp = aptos_infallible::duration_since_epoch().as_micros() as u64;
 
@@ -256,7 +256,7 @@ fn test_failed_authors_well_formed() {
     let other = Author::random();
     // Test genesis and the next block
     let quorum_cert = certificate_for_genesis();
-    let payload = Payload::empty();
+    let payload = Payload::empty(false);
 
     let create_block = |round: Round, failed_authors: Vec<(Round, Author)>| {
         Block::new_proposal(
diff --git a/consensus/consensus-types/src/block_test_utils.rs b/consensus/consensus-types/src/block_test_utils.rs
index 4b12fde089cd3..a12634444dfcb 100644
--- a/consensus/consensus-types/src/block_test_utils.rs
+++ b/consensus/consensus-types/src/block_test_utils.rs
@@ -42,7 +42,7 @@ prop_compose! {
         parent_qc in Just(parent_qc)
     ) -> Block {
         Block::new_proposal(
-            Payload::empty(),
+            Payload::empty(false),
             round,
             aptos_infallible::duration_since_epoch().as_micros() as u64,
             parent_qc,
diff --git a/consensus/consensus-types/src/common.rs b/consensus/consensus-types/src/common.rs
index 580f062c622c8..4592c7d40e30c 100644
--- a/consensus/consensus-types/src/common.rs
+++ b/consensus/consensus-types/src/common.rs
@@ -1,11 +1,19 @@
 // Copyright (c) Aptos
 // SPDX-License-Identifier: Apache-2.0
 
+use crate::proof_of_store::ProofOfStore;
 use aptos_crypto::HashValue;
+use aptos_executor_types::Error;
+use aptos_infallible::Mutex;
+use aptos_types::validator_verifier::ValidatorVerifier;
 use aptos_types::{account_address::AccountAddress, transaction::SignedTransaction};
 use rayon::prelude::*;
 use serde::{Deserialize, Serialize};
-use std::{fmt, fmt::Write};
+use std::collections::HashSet;
+use std::fmt;
+use std::fmt::Write;
+use std::sync::Arc;
+use tokio::sync::oneshot;
 
 /// The round of a block is a consensus-internal counter, which starts with 0 and increases
 /// monotonically. It is used for the protocol safety and liveness (please see the detailed
@@ -33,29 +41,79 @@ pub struct RejectedTransactionSummary {
     pub hash: HashValue,
 }
 
+#[derive(Debug)]
+pub enum DataStatus {
+    Cached(Vec),
+    Requested(
+        Vec<(
+            HashValue,
+            oneshot::Receiver, Error>>,
+        )>,
+    ),
+}
+
+#[derive(Deserialize, Serialize, Clone, Debug)]
+pub struct ProofWithData {
+    pub proofs: Vec,
+    #[serde(skip)]
+    pub status: Arc>>,
+}
+
+impl PartialEq for ProofWithData {
+    fn eq(&self, other: &Self) -> bool {
+        self.proofs == other.proofs && Arc::as_ptr(&self.status) == Arc::as_ptr(&other.status)
+    }
+}
+
+impl Eq for ProofWithData {}
+
+impl ProofWithData {
+    pub fn new(proofs: Vec) -> Self {
+        Self {
+            proofs,
+            status: Arc::new(Mutex::new(None)),
+        }
+    }
+}
+
 /// The payload in block.
 #[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Eq)]
 pub enum Payload {
     DirectMempool(Vec),
+    InQuorumStore(ProofWithData),
 }
 
 impl Payload {
-    pub fn empty() -> Self {
-        Payload::DirectMempool(Vec::new())
+    pub fn empty(quorum_store_enabled: bool) -> Self {
+        if quorum_store_enabled {
+            Payload::InQuorumStore(ProofWithData::new(Vec::new()))
+        } else {
+            Payload::DirectMempool(Vec::new())
+        }
     }
 
     pub fn len(&self) -> usize {
         match self {
             Payload::DirectMempool(txns) => txns.len(),
+            Payload::InQuorumStore(proof_with_status) => proof_with_status
+                .proofs
+                .iter()
+                .map(|proof| proof.info().num_txns as usize)
+                .sum(),
         }
     }
 
     pub fn is_empty(&self) -> bool {
         match self {
             Payload::DirectMempool(txns) => txns.is_empty(),
+            Payload::InQuorumStore(proof_with_status) => proof_with_status.proofs.is_empty(),
         }
     }
 
+    pub fn is_direct(&self) -> bool {
+        matches!(self, Payload::DirectMempool(_))
+    }
+
     /// This is computationally expensive on the first call
     pub fn size(&self) -> usize {
         match self {
@@ -64,18 +122,32 @@ impl Payload {
                 .with_min_len(100)
                 .map(|txn| txn.raw_txn_bytes_len())
                 .sum(),
+            Payload::InQuorumStore(proof_with_status) => proof_with_status
+                .proofs
+                .iter()
+                .map(|proof| proof.info().num_bytes as usize)
+                .sum(),
         }
     }
-}
-
-// TODO: What I really want is an iterator that isn't necessarily a vector (e.g., read lazily from RocksDB). This doesn't seem like the way.
-impl IntoIterator for Payload {
-    type Item = SignedTransaction;
-    type IntoIter = std::vec::IntoIter;
 
-    fn into_iter(self) -> Self::IntoIter {
-        match self {
-            Payload::DirectMempool(txns) => txns.into_iter(),
+    pub fn verify(
+        &self,
+        validator: &ValidatorVerifier,
+        quorum_store_enabled: bool,
+    ) -> anyhow::Result<()> {
+        match (quorum_store_enabled, self) {
+            (false, Payload::DirectMempool(_)) => Ok(()),
+            (true, Payload::InQuorumStore(proof_with_status)) => {
+                for proof in proof_with_status.proofs.iter() {
+                    proof.verify(validator)?;
+                }
+                Ok(())
+            }
+            (_, _) => Err(anyhow::anyhow!(
+                "Wrong payload type. Expected Payload::InQuorumStore {} got {} ",
+                quorum_store_enabled,
+                self
+            )),
         }
     }
 }
@@ -86,6 +158,9 @@ impl fmt::Display for Payload {
             Payload::DirectMempool(txns) => {
                 write!(f, "InMemory txns: {}", txns.len())
             }
+            Payload::InQuorumStore(proof_with_status) => {
+                write!(f, "InMemory proofs: {}", proof_with_status.proofs.len())
+            }
         }
     }
 }
@@ -94,18 +169,21 @@ impl fmt::Display for Payload {
 #[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Eq)]
 pub enum PayloadFilter {
     DirectMempool(Vec),
+    InQuorumStore(HashSet),
+    Empty,
 }
 
 impl From<&Vec<&Payload>> for PayloadFilter {
     fn from(exclude_payloads: &Vec<&Payload>) -> Self {
         if exclude_payloads.is_empty() {
-            return PayloadFilter::DirectMempool(vec![]);
+            return PayloadFilter::Empty;
         }
-        match exclude_payloads.first().unwrap() {
-            Payload::DirectMempool(_) => {
-                let mut exclude_txns = vec![];
-                for payload in exclude_payloads {
-                    let Payload::DirectMempool(txns) = payload;
+        let direct_mode = exclude_payloads.iter().any(|payload| payload.is_direct());
+
+        if direct_mode {
+            let mut exclude_txns = Vec::new();
+            for payload in exclude_payloads {
+                if let Payload::DirectMempool(txns) = payload {
                     for txn in txns {
                         exclude_txns.push(TransactionSummary {
                             sender: txn.sender(),
@@ -113,8 +191,18 @@ impl From<&Vec<&Payload>> for PayloadFilter {
                         });
                     }
                 }
-                PayloadFilter::DirectMempool(exclude_txns)
             }
+            PayloadFilter::DirectMempool(exclude_txns)
+        } else {
+            let mut exclude_proofs = HashSet::new();
+            for payload in exclude_payloads {
+                if let Payload::InQuorumStore(proof_with_status) = payload {
+                    for proof in &proof_with_status.proofs {
+                        exclude_proofs.insert(*proof.digest());
+                    }
+                }
+            }
+            PayloadFilter::InQuorumStore(exclude_proofs)
         }
     }
 }
@@ -129,6 +217,16 @@ impl fmt::Display for PayloadFilter {
                 }
                 write!(f, "{}", txns_str)
             }
+            PayloadFilter::InQuorumStore(excluded_proofs) => {
+                let mut proofs_str = "".to_string();
+                for proof in excluded_proofs.iter() {
+                    write!(proofs_str, "{} ", proof)?;
+                }
+                write!(f, "{}", proofs_str)
+            }
+            PayloadFilter::Empty => {
+                write!(f, "Empty filter")
+            }
         }
     }
 }
diff --git a/consensus/consensus-types/src/executed_block.rs b/consensus/consensus-types/src/executed_block.rs
index 24003d5b61c8b..ccfc6494af2da 100644
--- a/consensus/consensus-types/src/executed_block.rs
+++ b/consensus/consensus-types/src/executed_block.rs
@@ -8,13 +8,14 @@ use crate::{
     vote_proposal::VoteProposal,
 };
 use aptos_crypto::hash::HashValue;
+use aptos_executor_types::StateComputeResult;
+use aptos_types::transaction::SignedTransaction;
 use aptos_types::{
     account_address::AccountAddress,
     block_info::BlockInfo,
     contract_event::ContractEvent,
     transaction::{Transaction, TransactionStatus},
 };
-use executor_types::StateComputeResult;
 use std::fmt::{Debug, Display, Formatter};
 
 /// ExecutedBlocks are managed in a speculative tree, the committed blocks form a chain. Besides
@@ -103,13 +104,18 @@ impl ExecutedBlock {
         )
     }
 
-    pub fn transactions_to_commit(&self, validators: &[AccountAddress]) -> Vec {
+    pub fn transactions_to_commit(
+        &self,
+        validators: &[AccountAddress],
+        txns: Vec,
+    ) -> Vec {
         // reconfiguration suffix don't execute
+
         if self.is_reconfiguration_suffix() {
             return vec![];
         }
         itertools::zip_eq(
-            self.block.transactions_to_execute(validators),
+            self.block.transactions_to_execute(validators, txns),
             self.state_compute_result.compute_status(),
         )
         .filter_map(|(txn, status)| match status {
diff --git a/consensus/consensus-types/src/lib.rs b/consensus/consensus-types/src/lib.rs
index 8874293863d7b..7303156fd17cb 100644
--- a/consensus/consensus-types/src/lib.rs
+++ b/consensus/consensus-types/src/lib.rs
@@ -10,6 +10,7 @@ pub mod common;
 pub mod epoch_retrieval;
 pub mod executed_block;
 pub mod experimental;
+pub mod proof_of_store;
 pub mod proposal_msg;
 pub mod quorum_cert;
 pub mod request_response;
diff --git a/consensus/consensus-types/src/proof_of_store.rs b/consensus/consensus-types/src/proof_of_store.rs
new file mode 100644
index 0000000000000..fcc98bba7ae94
--- /dev/null
+++ b/consensus/consensus-types/src/proof_of_store.rs
@@ -0,0 +1,79 @@
+// Copyright (c) Aptos
+// SPDX-License-Identifier: Apache-2.0
+
+use crate::common::Round;
+use anyhow::Context;
+use aptos_crypto::HashValue;
+use aptos_crypto_derive::{BCSCryptoHash, CryptoHasher};
+use aptos_types::aggregate_signature::AggregateSignature;
+use aptos_types::validator_verifier::ValidatorVerifier;
+use serde::{Deserialize, Serialize};
+
+#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Deserialize, Serialize, Hash)]
+pub struct LogicalTime {
+    epoch: u64,
+    round: Round,
+}
+
+impl LogicalTime {
+    pub fn new(epoch: u64, round: Round) -> Self {
+        Self { epoch, round }
+    }
+
+    pub fn epoch(&self) -> u64 {
+        self.epoch
+    }
+
+    pub fn round(&self) -> Round {
+        self.round
+    }
+}
+
+#[derive(
+    Clone, Debug, Deserialize, Serialize, CryptoHasher, BCSCryptoHash, PartialEq, Eq, Hash,
+)]
+pub struct SignedDigestInfo {
+    pub digest: HashValue,
+    pub expiration: LogicalTime,
+    pub num_txns: u64,
+    pub num_bytes: u64,
+}
+
+#[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Eq)]
+#[allow(dead_code)]
+pub struct ProofOfStore {
+    info: SignedDigestInfo,
+    multi_signature: AggregateSignature,
+}
+
+#[allow(dead_code)]
+impl ProofOfStore {
+    pub fn new(info: SignedDigestInfo, multi_signature: AggregateSignature) -> Self {
+        Self {
+            info,
+            multi_signature,
+        }
+    }
+
+    pub fn info(&self) -> &SignedDigestInfo {
+        &self.info
+    }
+
+    pub fn digest(&self) -> &HashValue {
+        &self.info.digest
+    }
+
+    pub fn expiration(&self) -> LogicalTime {
+        self.info.expiration
+    }
+
+    pub fn verify(&self, validator: &ValidatorVerifier) -> anyhow::Result<()> {
+        validator
+            .verify_multi_signatures(&self.info, &self.multi_signature)
+            .context("Failed to verify ProofOfStore")
+    }
+
+    pub fn epoch(&self) -> u64 {
+        self.info.expiration.epoch
+    }
+}
diff --git a/consensus/consensus-types/src/proposal_msg.rs b/consensus/consensus-types/src/proposal_msg.rs
index f318564bd8ccc..0a1eac4c129ff 100644
--- a/consensus/consensus-types/src/proposal_msg.rs
+++ b/consensus/consensus-types/src/proposal_msg.rs
@@ -79,8 +79,12 @@ impl ProposalMsg {
         Ok(())
     }
 
-    pub fn verify(&self, validator: &ValidatorVerifier) -> Result<()> {
-        self.proposal
+    pub fn verify(&self, validator: &ValidatorVerifier, quorum_store_enabled: bool) -> Result<()> {
+        self.proposal()
+            .payload()
+            .map_or(Ok(()), |p| p.verify(validator, quorum_store_enabled))?;
+
+        self.proposal()
             .validate_signature(validator)
             .map_err(|e| format_err!("{:?}", e))?;
         // if there is a timeout certificate, verify its signatures
diff --git a/consensus/consensus-types/src/request_response.rs b/consensus/consensus-types/src/request_response.rs
index f14d73ebf52a5..b0cd38764da79 100644
--- a/consensus/consensus-types/src/request_response.rs
+++ b/consensus/consensus-types/src/request_response.rs
@@ -2,14 +2,17 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::common::{Payload, PayloadFilter, Round};
+use crate::proof_of_store::LogicalTime;
 use anyhow::Result;
+use aptos_crypto::HashValue;
 use futures::channel::oneshot;
 use std::{fmt, fmt::Formatter};
 
 /// Message sent from Consensus to QuorumStore.
-pub enum ConsensusRequest {
+pub enum PayloadRequest {
     /// Request to pull block to submit to consensus.
     GetBlockRequest(
+        Round,
         // max block size
         u64,
         // max byte size
@@ -20,28 +23,27 @@ pub enum ConsensusRequest {
         oneshot::Sender>,
     ),
     /// Request to clean quorum store at commit logical time
-    CleanRequest(
-        // epoch
-        u64,
-        // round
-        Round,
-        // callback to respond to
-        oneshot::Sender>,
-    ),
+    CleanRequest(LogicalTime, Vec),
 }
 
-impl fmt::Display for ConsensusRequest {
+impl fmt::Display for PayloadRequest {
     fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
         match self {
-            ConsensusRequest::GetBlockRequest(max_txns, max_bytes, excluded, _) => {
+            PayloadRequest::GetBlockRequest(round, max_txns, max_bytes, excluded, _) => {
                 write!(
                     f,
-                    "GetBlockRequest [max_txns: {}, max_bytes: {} excluded: {}]",
-                    max_txns, max_bytes, excluded
+                    "GetBlockRequest [round: {}, max_txns: {}, max_bytes: {} excluded: {}]",
+                    round, max_txns, max_bytes, excluded
                 )
             }
-            ConsensusRequest::CleanRequest(epoch, round, _) => {
-                write!(f, "CleanRequest [epoch: {}, round: {}]", epoch, round)
+            PayloadRequest::CleanRequest(logical_time, digests) => {
+                write!(
+                    f,
+                    "CleanRequest [epoch: {}, round: {}, digests: {:?}]",
+                    logical_time.epoch(),
+                    logical_time.round(),
+                    digests
+                )
             }
         }
     }
@@ -49,5 +51,4 @@ impl fmt::Display for ConsensusRequest {
 
 pub enum ConsensusResponse {
     GetBlockResponse(Payload),
-    CleanResponse(),
 }
diff --git a/consensus/safety-rules/Cargo.toml b/consensus/safety-rules/Cargo.toml
index d78d6c6c10786..8c21f30a4783e 100644
--- a/consensus/safety-rules/Cargo.toml
+++ b/consensus/safety-rules/Cargo.toml
@@ -14,6 +14,7 @@ rust-version = { workspace = true }
 
 [dependencies]
 aptos-config = { workspace = true }
+aptos-consensus-types = { workspace = true }
 aptos-crypto = { workspace = true }
 aptos-global-constants = { workspace = true }
 aptos-infallible = { workspace = true }
@@ -25,7 +26,6 @@ aptos-secure-storage = { workspace = true }
 aptos-temppath = { workspace = true }
 aptos-types = { workspace = true }
 aptos-vault-client = { workspace = true }
-consensus-types = { workspace = true }
 once_cell = { workspace = true }
 proptest = { workspace = true, optional = true }
 rand = { workspace = true }
@@ -35,9 +35,9 @@ thiserror = { workspace = true }
 
 [dev-dependencies]
 aptos-config = { workspace = true, features = ["fuzzing"] }
+aptos-consensus-types = { workspace = true, features = ["fuzzing"] }
 aptos-proptest-helpers = { workspace = true }
 aptos-secure-storage = { workspace = true, features = ["testing"] }
-consensus-types = { workspace = true, features = ["fuzzing"] }
 criterion = { workspace = true }
 proptest = { workspace = true }
 rusty-fork = { workspace = true }
@@ -50,5 +50,5 @@ required-features = ["testing"]
 
 [features]
 default = []
-fuzzing = ["consensus-types/fuzzing", "aptos-config/fuzzing", "proptest", "aptos-proptest-helpers"]
+fuzzing = ["aptos-consensus-types/fuzzing", "aptos-config/fuzzing", "proptest", "aptos-proptest-helpers"]
 testing = ["aptos-secure-storage/testing"]
diff --git a/consensus/safety-rules/benches/safety_rules.rs b/consensus/safety-rules/benches/safety_rules.rs
index baa61d062bef5..048b8158ba411 100644
--- a/consensus/safety-rules/benches/safety_rules.rs
+++ b/consensus/safety-rules/benches/safety_rules.rs
@@ -1,9 +1,9 @@
 // Copyright (c) Aptos
 // SPDX-License-Identifier: Apache-2.0
 
+use aptos_consensus_types::block::block_test_utils;
 use aptos_secure_storage::{InMemoryStorage, KVStorage, OnDiskStorage, Storage, VaultStorage};
 use aptos_types::validator_signer::ValidatorSigner;
-use consensus_types::block::block_test_utils;
 use criterion::{black_box, criterion_group, criterion_main, Criterion};
 use safety_rules::{test_utils, PersistentSafetyStorage, SafetyRulesManager, TSafetyRules};
 use tempfile::NamedTempFile;
diff --git a/consensus/safety-rules/src/consensus_state.rs b/consensus/safety-rules/src/consensus_state.rs
index 416c7b4e36bf3..9dc86c4977ee2 100644
--- a/consensus/safety-rules/src/consensus_state.rs
+++ b/consensus/safety-rules/src/consensus_state.rs
@@ -1,8 +1,8 @@
 // Copyright (c) Aptos
 // SPDX-License-Identifier: Apache-2.0
 
+use aptos_consensus_types::{common::Round, safety_data::SafetyData};
 use aptos_types::waypoint::Waypoint;
-use consensus_types::{common::Round, safety_data::SafetyData};
 use serde::{Deserialize, Serialize};
 use std::fmt::{Display, Formatter};
 
diff --git a/consensus/safety-rules/src/fuzzing_utils.rs b/consensus/safety-rules/src/fuzzing_utils.rs
index 5804e647a9343..86f62f2e7a3d9 100644
--- a/consensus/safety-rules/src/fuzzing_utils.rs
+++ b/consensus/safety-rules/src/fuzzing_utils.rs
@@ -2,6 +2,16 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::serializer::SafetyRulesInput;
+#[cfg(any(test, feature = "fuzzing"))]
+use aptos_consensus_types::block::Block;
+use aptos_consensus_types::{
+    block_data::{BlockData, BlockType},
+    common::Payload,
+    quorum_cert::QuorumCert,
+    timeout_2chain::TwoChainTimeout,
+    vote_data::VoteData,
+    vote_proposal::VoteProposal,
+};
 use aptos_crypto::{
     bls12381,
     hash::{HashValue, TransactionAccumulatorHasher},
@@ -18,16 +28,6 @@ use aptos_types::{
     transaction::SignedTransaction,
     validator_verifier::{ValidatorConsensusInfo, ValidatorVerifier},
 };
-#[cfg(any(test, feature = "fuzzing"))]
-use consensus_types::block::Block;
-use consensus_types::{
-    block_data::{BlockData, BlockType},
-    common::Payload,
-    quorum_cert::QuorumCert,
-    timeout_2chain::TwoChainTimeout,
-    vote_data::VoteData,
-    vote_proposal::VoteProposal,
-};
 use proptest::prelude::*;
 use rand::{rngs::StdRng, SeedableRng};
 
@@ -236,12 +236,12 @@ pub fn arb_safety_rules_input() -> impl Strategy {
 #[cfg(any(test, feature = "fuzzing"))]
 pub mod fuzzing {
     use crate::{error::Error, serializer::SafetyRulesInput, test_utils, TSafetyRules};
-    use aptos_crypto::bls12381;
-    use aptos_types::epoch_change::EpochChangeProof;
-    use consensus_types::{
+    use aptos_consensus_types::{
         block_data::BlockData, timeout_2chain::TwoChainTimeout, vote::Vote,
         vote_proposal::VoteProposal,
     };
+    use aptos_crypto::bls12381;
+    use aptos_types::epoch_change::EpochChangeProof;
 
     pub fn fuzz_initialize(proof: EpochChangeProof) -> Result<(), Error> {
         let mut safety_rules = test_utils::test_safety_rules_uninitialized();
diff --git a/consensus/safety-rules/src/local_client.rs b/consensus/safety-rules/src/local_client.rs
index abd5e35631f72..61391b3c9ec2b 100644
--- a/consensus/safety-rules/src/local_client.rs
+++ b/consensus/safety-rules/src/local_client.rs
@@ -2,18 +2,18 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::{ConsensusState, Error, SafetyRules, TSafetyRules};
+use aptos_consensus_types::{
+    block_data::BlockData,
+    timeout_2chain::{TwoChainTimeout, TwoChainTimeoutCertificate},
+    vote::Vote,
+    vote_proposal::VoteProposal,
+};
 use aptos_crypto::bls12381;
 use aptos_infallible::RwLock;
 use aptos_types::{
     epoch_change::EpochChangeProof,
     ledger_info::{LedgerInfo, LedgerInfoWithSignatures},
 };
-use consensus_types::{
-    block_data::BlockData,
-    timeout_2chain::{TwoChainTimeout, TwoChainTimeoutCertificate},
-    vote::Vote,
-    vote_proposal::VoteProposal,
-};
 use std::sync::Arc;
 
 /// A local interface into SafetyRules. Constructed in such a way that the container / caller
diff --git a/consensus/safety-rules/src/logging.rs b/consensus/safety-rules/src/logging.rs
index 5896ad37bfbef..f1a44a8b0a79a 100644
--- a/consensus/safety-rules/src/logging.rs
+++ b/consensus/safety-rules/src/logging.rs
@@ -2,9 +2,9 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::Error;
+use aptos_consensus_types::common::{Author, Round};
 use aptos_logger::Schema;
 use aptos_types::waypoint::Waypoint;
-use consensus_types::common::{Author, Round};
 use serde::Serialize;
 
 #[derive(Schema)]
diff --git a/consensus/safety-rules/src/persistent_safety_storage.rs b/consensus/safety-rules/src/persistent_safety_storage.rs
index 789ba91134a71..9827b4fd4ae7d 100644
--- a/consensus/safety-rules/src/persistent_safety_storage.rs
+++ b/consensus/safety-rules/src/persistent_safety_storage.rs
@@ -6,12 +6,12 @@ use crate::{
     logging::{self, LogEntry, LogEvent},
     Error,
 };
+use aptos_consensus_types::{common::Author, safety_data::SafetyData};
 use aptos_crypto::{bls12381, PrivateKey};
 use aptos_global_constants::{CONSENSUS_KEY, OWNER_ACCOUNT, SAFETY_DATA, WAYPOINT};
 use aptos_logger::prelude::*;
 use aptos_secure_storage::{KVStorage, Storage};
 use aptos_types::waypoint::Waypoint;
-use consensus_types::{common::Author, safety_data::SafetyData};
 
 /// SafetyRules needs an abstract storage interface to act as a common utility for storing
 /// persistent data to local disk, cloud, secrets managers, or even memory (for tests)
diff --git a/consensus/safety-rules/src/safety_rules.rs b/consensus/safety-rules/src/safety_rules.rs
index 81857b63f2c54..83a534bf499f8 100644
--- a/consensus/safety-rules/src/safety_rules.rs
+++ b/consensus/safety-rules/src/safety_rules.rs
@@ -9,16 +9,7 @@ use crate::{
     persistent_safety_storage::PersistentSafetyStorage,
     t_safety_rules::TSafetyRules,
 };
-use aptos_crypto::{bls12381, hash::CryptoHash};
-use aptos_logger::prelude::*;
-use aptos_types::{
-    epoch_change::EpochChangeProof,
-    epoch_state::EpochState,
-    ledger_info::{LedgerInfo, LedgerInfoWithSignatures},
-    validator_signer::ValidatorSigner,
-    waypoint::Waypoint,
-};
-use consensus_types::{
+use aptos_consensus_types::{
     block_data::BlockData,
     common::{Author, Round},
     quorum_cert::QuorumCert,
@@ -28,6 +19,15 @@ use consensus_types::{
     vote_data::VoteData,
     vote_proposal::VoteProposal,
 };
+use aptos_crypto::{bls12381, hash::CryptoHash};
+use aptos_logger::prelude::*;
+use aptos_types::{
+    epoch_change::EpochChangeProof,
+    epoch_state::EpochState,
+    ledger_info::{LedgerInfo, LedgerInfoWithSignatures},
+    validator_signer::ValidatorSigner,
+    waypoint::Waypoint,
+};
 use serde::Serialize;
 use std::cmp::Ordering;
 
diff --git a/consensus/safety-rules/src/safety_rules_2chain.rs b/consensus/safety-rules/src/safety_rules_2chain.rs
index 5d7261fcfcc32..07dca852fe16c 100644
--- a/consensus/safety-rules/src/safety_rules_2chain.rs
+++ b/consensus/safety-rules/src/safety_rules_2chain.rs
@@ -2,15 +2,15 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::{error::Error, safety_rules::next_round, SafetyRules};
-use aptos_crypto::{bls12381, hash::CryptoHash, HashValue};
-use aptos_types::{block_info::BlockInfo, ledger_info::LedgerInfo};
-use consensus_types::{
+use aptos_consensus_types::{
     block::Block,
     safety_data::SafetyData,
     timeout_2chain::{TwoChainTimeout, TwoChainTimeoutCertificate},
     vote::Vote,
     vote_proposal::VoteProposal,
 };
+use aptos_crypto::{bls12381, hash::CryptoHash, HashValue};
+use aptos_types::{block_info::BlockInfo, ledger_info::LedgerInfo};
 
 /// 2-chain safety rules implementation
 impl SafetyRules {
diff --git a/consensus/safety-rules/src/serializer.rs b/consensus/safety-rules/src/serializer.rs
index 54be29646be54..a9f772b4eff23 100644
--- a/consensus/safety-rules/src/serializer.rs
+++ b/consensus/safety-rules/src/serializer.rs
@@ -2,18 +2,18 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::{counters, logging::LogEntry, ConsensusState, Error, SafetyRules, TSafetyRules};
+use aptos_consensus_types::{
+    block_data::BlockData,
+    timeout_2chain::{TwoChainTimeout, TwoChainTimeoutCertificate},
+    vote::Vote,
+    vote_proposal::VoteProposal,
+};
 use aptos_crypto::bls12381;
 use aptos_infallible::RwLock;
 use aptos_types::{
     epoch_change::EpochChangeProof,
     ledger_info::{LedgerInfo, LedgerInfoWithSignatures},
 };
-use consensus_types::{
-    block_data::BlockData,
-    timeout_2chain::{TwoChainTimeout, TwoChainTimeoutCertificate},
-    vote::Vote,
-    vote_proposal::VoteProposal,
-};
 use serde::{Deserialize, Serialize};
 use std::sync::Arc;
 
diff --git a/consensus/safety-rules/src/t_safety_rules.rs b/consensus/safety-rules/src/t_safety_rules.rs
index a55867b3ff1d6..ec75ae836a8ae 100644
--- a/consensus/safety-rules/src/t_safety_rules.rs
+++ b/consensus/safety-rules/src/t_safety_rules.rs
@@ -2,17 +2,17 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::{ConsensusState, Error};
-use aptos_crypto::bls12381;
-use aptos_types::{
-    epoch_change::EpochChangeProof,
-    ledger_info::{LedgerInfo, LedgerInfoWithSignatures},
-};
-use consensus_types::{
+use aptos_consensus_types::{
     block_data::BlockData,
     timeout_2chain::{TwoChainTimeout, TwoChainTimeoutCertificate},
     vote::Vote,
     vote_proposal::VoteProposal,
 };
+use aptos_crypto::bls12381;
+use aptos_types::{
+    epoch_change::EpochChangeProof,
+    ledger_info::{LedgerInfo, LedgerInfoWithSignatures},
+};
 
 /// Interface for SafetyRules
 pub trait TSafetyRules {
diff --git a/consensus/safety-rules/src/test_utils.rs b/consensus/safety-rules/src/test_utils.rs
index 3a61db8978245..223c07d34fdb9 100644
--- a/consensus/safety-rules/src/test_utils.rs
+++ b/consensus/safety-rules/src/test_utils.rs
@@ -5,6 +5,16 @@ use crate::{
     persistent_safety_storage::PersistentSafetyStorage, serializer::SerializerService, SafetyRules,
     TSafetyRules,
 };
+use aptos_consensus_types::timeout_2chain::TwoChainTimeoutWithPartialSignatures;
+use aptos_consensus_types::{
+    block::Block,
+    common::{Payload, Round},
+    quorum_cert::QuorumCert,
+    timeout_2chain::{TwoChainTimeout, TwoChainTimeoutCertificate},
+    vote::Vote,
+    vote_data::VoteData,
+    vote_proposal::VoteProposal,
+};
 use aptos_crypto::hash::{CryptoHash, TransactionAccumulatorHasher};
 use aptos_secure_storage::{InMemoryStorage, Storage};
 use aptos_types::{
@@ -20,16 +30,6 @@ use aptos_types::{
     validator_verifier::generate_validator_verifier,
     waypoint::Waypoint,
 };
-use consensus_types::timeout_2chain::TwoChainTimeoutWithPartialSignatures;
-use consensus_types::{
-    block::Block,
-    common::{Payload, Round},
-    quorum_cert::QuorumCert,
-    timeout_2chain::{TwoChainTimeout, TwoChainTimeoutCertificate},
-    vote::Vote,
-    vote_data::VoteData,
-    vote_proposal::VoteProposal,
-};
 
 pub type Proof = AccumulatorExtensionProof;
 
@@ -77,7 +77,13 @@ pub fn make_proposal_with_qc(
     qc: QuorumCert,
     validator_signer: &ValidatorSigner,
 ) -> VoteProposal {
-    make_proposal_with_qc_and_proof(Payload::empty(), round, empty_proof(), qc, validator_signer)
+    make_proposal_with_qc_and_proof(
+        Payload::empty(false),
+        round,
+        empty_proof(),
+        qc,
+        validator_signer,
+    )
 }
 
 pub fn make_proposal_with_parent_and_overrides(
diff --git a/consensus/safety-rules/src/tests/suite.rs b/consensus/safety-rules/src/tests/suite.rs
index 4bba8ae2eab06..91e1d3e5280ea 100644
--- a/consensus/safety-rules/src/tests/suite.rs
+++ b/consensus/safety-rules/src/tests/suite.rs
@@ -2,6 +2,13 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::{test_utils, test_utils::make_timeout_cert, Error, TSafetyRules};
+use aptos_consensus_types::{
+    block::block_test_utils::random_payload,
+    common::{Payload, Round},
+    quorum_cert::QuorumCert,
+    timeout_2chain::{TwoChainTimeout, TwoChainTimeoutCertificate},
+    vote_proposal::VoteProposal,
+};
 use aptos_crypto::hash::{HashValue, ACCUMULATOR_PLACEHOLDER_HASH};
 use aptos_types::aggregate_signature::AggregateSignature;
 use aptos_types::{
@@ -11,13 +18,6 @@ use aptos_types::{
     validator_signer::ValidatorSigner,
     validator_verifier::ValidatorVerifier,
 };
-use consensus_types::{
-    block::block_test_utils::random_payload,
-    common::{Payload, Round},
-    quorum_cert::QuorumCert,
-    timeout_2chain::{TwoChainTimeout, TwoChainTimeoutCertificate},
-    vote_proposal::VoteProposal,
-};
 
 type Proof = test_utils::Proof;
 
@@ -27,7 +27,7 @@ fn make_proposal_with_qc_and_proof(
     qc: QuorumCert,
     signer: &ValidatorSigner,
 ) -> VoteProposal {
-    test_utils::make_proposal_with_qc_and_proof(Payload::empty(), round, proof, qc, signer)
+    test_utils::make_proposal_with_qc_and_proof(Payload::empty(false), round, proof, qc, signer)
 }
 
 fn make_proposal_with_parent(
@@ -36,7 +36,7 @@ fn make_proposal_with_parent(
     committed: Option<&VoteProposal>,
     signer: &ValidatorSigner,
 ) -> VoteProposal {
-    test_utils::make_proposal_with_parent(Payload::empty(), round, parent, committed, signer)
+    test_utils::make_proposal_with_parent(Payload::empty(false), round, parent, committed, signer)
 }
 
 pub type Callback = Box (Box, ValidatorSigner)>;
@@ -184,7 +184,7 @@ fn test_voting_bad_epoch(safety_rules: &Callback) {
 
     let a1 = test_utils::make_proposal_with_qc(round + 1, genesis_qc, &signer);
     let a2 = test_utils::make_proposal_with_parent_and_overrides(
-        Payload::empty(),
+        Payload::empty(false),
         round + 3,
         &a1,
         None,
@@ -352,7 +352,7 @@ fn test_validator_not_in_set(safety_rules: &Callback) {
     next_epoch_state.verifier =
         ValidatorVerifier::new_single(rand_signer.author(), rand_signer.public_key());
     let a2 = test_utils::make_proposal_with_parent_and_overrides(
-        Payload::empty(),
+        Payload::empty(false),
         round + 2,
         &a1,
         Some(&a1),
@@ -390,7 +390,7 @@ fn test_key_not_in_store(safety_rules: &Callback) {
     next_epoch_state.verifier =
         ValidatorVerifier::new_single(signer.author(), rand_signer.public_key());
     let a2 = test_utils::make_proposal_with_parent_and_overrides(
-        Payload::empty(),
+        Payload::empty(false),
         round + 2,
         &a1,
         Some(&a1),
diff --git a/consensus/src/block_storage/block_store.rs b/consensus/src/block_storage/block_store.rs
index a10172596dc2e..fefff177f24f4 100644
--- a/consensus/src/block_storage/block_store.rs
+++ b/consensus/src/block_storage/block_store.rs
@@ -8,6 +8,7 @@ use crate::{
         BlockReader,
     },
     counters,
+    payload_manager::PayloadManager,
     persistent_liveness_storage::{
         PersistentLivenessStorage, RecoveryData, RootInfo, RootMetadata,
     },
@@ -16,15 +17,15 @@ use crate::{
 };
 use anyhow::{bail, ensure, format_err, Context};
 
+use aptos_consensus_types::{
+    block::Block, common::Round, executed_block::ExecutedBlock, quorum_cert::QuorumCert,
+    sync_info::SyncInfo, timeout_2chain::TwoChainTimeoutCertificate,
+};
 use aptos_crypto::{hash::ACCUMULATOR_PLACEHOLDER_HASH, HashValue};
+use aptos_executor_types::{Error, StateComputeResult};
 use aptos_infallible::RwLock;
 use aptos_logger::prelude::*;
 use aptos_types::{ledger_info::LedgerInfoWithSignatures, transaction::TransactionStatus};
-use consensus_types::{
-    block::Block, common::Round, executed_block::ExecutedBlock, quorum_cert::QuorumCert,
-    sync_info::SyncInfo, timeout_2chain::TwoChainTimeoutCertificate,
-};
-use executor_types::{Error, StateComputeResult};
 use futures::executor::block_on;
 use std::{sync::Arc, time::Duration};
 
@@ -103,6 +104,7 @@ pub struct BlockStore {
     time_service: Arc,
     // consistent with round type
     back_pressure_limit: Round,
+    payload_manager: Arc,
     #[cfg(any(test, feature = "fuzzing"))]
     back_pressure_for_test: AtomicBool,
 }
@@ -115,6 +117,7 @@ impl BlockStore {
         max_pruned_blocks_in_mem: usize,
         time_service: Arc,
         back_pressure_limit: Round,
+        payload_manager: Arc,
     ) -> Self {
         let highest_2chain_tc = initial_data.highest_2chain_timeout_certificate();
         let (root, root_metadata, blocks, quorum_certs) = initial_data.take();
@@ -129,6 +132,7 @@ impl BlockStore {
             max_pruned_blocks_in_mem,
             time_service,
             back_pressure_limit,
+            payload_manager,
         ));
         block_on(block_store.try_commit());
         block_store
@@ -166,6 +170,7 @@ impl BlockStore {
         max_pruned_blocks_in_mem: usize,
         time_service: Arc,
         back_pressure_limit: Round,
+        payload_manager: Arc,
     ) -> Self {
         let RootInfo(root_block, root_qc, root_ordered_cert, root_commit_cert) = root;
 
@@ -220,6 +225,7 @@ impl BlockStore {
             storage,
             time_service,
             back_pressure_limit,
+            payload_manager,
             #[cfg(any(test, feature = "fuzzing"))]
             back_pressure_for_test: AtomicBool::new(false),
         };
@@ -316,6 +322,7 @@ impl BlockStore {
             max_pruned_blocks_in_mem,
             Arc::clone(&self.time_service),
             self.back_pressure_limit,
+            self.payload_manager.clone(),
         )
         .await;
 
@@ -375,6 +382,9 @@ impl BlockStore {
             }
             self.time_service.wait_until(block_time).await;
         }
+        self.payload_manager
+            .prefetch_payload_data(executed_block.block())
+            .await;
         self.storage
             .save_tree(vec![executed_block.block().clone()], vec![])
             .context("Insert block failed when saving block")?;
diff --git a/consensus/src/block_storage/block_store_test.rs b/consensus/src/block_storage/block_store_test.rs
index 7e8ab4cd11ab7..e5715a5f3d310 100644
--- a/consensus/src/block_storage/block_store_test.rs
+++ b/consensus/src/block_storage/block_store_test.rs
@@ -8,11 +8,7 @@ use crate::{
         build_empty_tree, build_simple_tree, consensus_runtime, timed_block_on, TreeInserter,
     },
 };
-use aptos_crypto::{HashValue, PrivateKey};
-use aptos_types::{
-    validator_signer::ValidatorSigner, validator_verifier::random_validator_verifier,
-};
-use consensus_types::{
+use aptos_consensus_types::{
     block::{
         block_test_utils::{
             self, certificate_for_genesis, gen_test_certificate, placeholder_certificate_for_block,
@@ -24,6 +20,10 @@ use consensus_types::{
     vote::Vote,
     vote_data::VoteData,
 };
+use aptos_crypto::{HashValue, PrivateKey};
+use aptos_types::{
+    validator_signer::ValidatorSigner, validator_verifier::random_validator_verifier,
+};
 use proptest::prelude::*;
 use std::{cmp::min, collections::HashSet};
 
@@ -349,7 +349,7 @@ async fn test_illegal_timestamp() {
     let block_store = build_empty_tree();
     let genesis = block_store.ordered_root();
     let block_with_illegal_timestamp = Block::new_proposal(
-        Payload::empty(),
+        Payload::empty(false),
         0,
         // This timestamp is illegal, it is the same as genesis
         genesis.timestamp_usecs(),
@@ -454,7 +454,7 @@ async fn test_need_sync_for_ledger_info() {
             certificate_for_genesis(),
             1,
             round,
-            Payload::empty(),
+            Payload::empty(false),
             vec![],
         );
         gen_test_certificate(
diff --git a/consensus/src/block_storage/block_tree.rs b/consensus/src/block_storage/block_tree.rs
index 76cf30fe3e082..e879481a51fb4 100644
--- a/consensus/src/block_storage/block_tree.rs
+++ b/consensus/src/block_storage/block_tree.rs
@@ -8,20 +8,20 @@ use crate::{
     persistent_liveness_storage::PersistentLivenessStorage,
 };
 use anyhow::bail;
-use aptos_crypto::HashValue;
-use aptos_logger::prelude::*;
-use aptos_types::{block_info::BlockInfo, ledger_info::LedgerInfoWithSignatures};
-use consensus_types::{
+use aptos_consensus_types::{
     executed_block::ExecutedBlock, quorum_cert::QuorumCert,
     timeout_2chain::TwoChainTimeoutCertificate,
 };
+use aptos_crypto::HashValue;
+use aptos_logger::prelude::*;
+use aptos_types::{block_info::BlockInfo, ledger_info::LedgerInfoWithSignatures};
 use mirai_annotations::{checked_verify_eq, precondition};
 use std::{
     collections::{vec_deque::VecDeque, HashMap, HashSet},
     sync::Arc,
 };
 
-/// This structure is a wrapper of [`ExecutedBlock`](crate::consensus_types::block::ExecutedBlock)
+/// This structure is a wrapper of [`ExecutedBlock`](aptos_consensus_types::executed_block::ExecutedBlock)
 /// that adds `children` field to know the parent-child relationship between blocks.
 struct LinkableBlock {
     /// Executed block that has raw block data and execution output.
diff --git a/consensus/src/block_storage/mod.rs b/consensus/src/block_storage/mod.rs
index 80fdeb3c66bad..dd437c38ce5f7 100644
--- a/consensus/src/block_storage/mod.rs
+++ b/consensus/src/block_storage/mod.rs
@@ -1,12 +1,12 @@
 // Copyright (c) Aptos
 // SPDX-License-Identifier: Apache-2.0
 
-use aptos_crypto::HashValue;
-pub use block_store::{sync_manager::BlockRetriever, BlockStore};
-use consensus_types::{
+use aptos_consensus_types::{
     executed_block::ExecutedBlock, quorum_cert::QuorumCert, sync_info::SyncInfo,
     timeout_2chain::TwoChainTimeoutCertificate,
 };
+use aptos_crypto::HashValue;
+pub use block_store::{sync_manager::BlockRetriever, BlockStore};
 use std::sync::Arc;
 
 mod block_store;
diff --git a/consensus/src/block_storage/sync_manager.rs b/consensus/src/block_storage/sync_manager.rs
index 81bd2a402ada5..c4c0638ef3084 100644
--- a/consensus/src/block_storage/sync_manager.rs
+++ b/consensus/src/block_storage/sync_manager.rs
@@ -11,13 +11,7 @@ use crate::{
     state_replication::StateComputer,
 };
 use anyhow::{bail, Context};
-use aptos_crypto::HashValue;
-use aptos_logger::prelude::*;
-use aptos_types::{
-    account_address::AccountAddress, epoch_change::EpochChangeProof,
-    ledger_info::LedgerInfoWithSignatures,
-};
-use consensus_types::{
+use aptos_consensus_types::{
     block::Block,
     block_retrieval::{
         BlockRetrievalRequest, BlockRetrievalResponse, BlockRetrievalStatus,
@@ -27,6 +21,12 @@ use consensus_types::{
     quorum_cert::QuorumCert,
     sync_info::SyncInfo,
 };
+use aptos_crypto::HashValue;
+use aptos_logger::prelude::*;
+use aptos_types::{
+    account_address::AccountAddress, epoch_change::EpochChangeProof,
+    ledger_info::LedgerInfoWithSignatures,
+};
 use fail::fail_point;
 use rand::{prelude::*, Rng};
 use std::{clone::Clone, cmp::min, sync::Arc, time::Duration};
diff --git a/consensus/src/commit_notifier.rs b/consensus/src/commit_notifier.rs
deleted file mode 100644
index be2d97b38ba58..0000000000000
--- a/consensus/src/commit_notifier.rs
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) Aptos
-// SPDX-License-Identifier: Apache-2.0
-
-use crate::error::QuorumStoreError;
-use crate::monitor;
-use anyhow::{format_err, Result};
-use aptos_infallible::Mutex;
-use consensus_types::{common::Round, request_response::ConsensusRequest};
-use futures::channel::{mpsc, mpsc::Sender, oneshot};
-use std::time::Duration;
-use tokio::time::timeout;
-
-/// Notification of execution committed logical time for QuorumStore to clean.
-#[async_trait::async_trait]
-pub trait CommitNotifier: Send + Sync {
-    /// Notification of committed logical time
-    async fn notify_commit(&self, epoch: u64, round: Round) -> Result<(), QuorumStoreError>;
-
-    fn new_epoch(&self, quorum_store_commit_sender: mpsc::Sender);
-}
-
-/// Execution -> QuorumStore notification of commits.
-pub struct QuorumStoreCommitNotifier {
-    quorum_store_commit_sender: Mutex>,
-    /// Timeout for QuorumStore clean ack
-    quorum_store_commit_timeout_ms: u64,
-}
-
-impl QuorumStoreCommitNotifier {
-    /// new
-    pub fn new(quorum_store_commit_timeout_ms: u64) -> Self {
-        let (dummy_sender, _) = mpsc::channel(1);
-        Self {
-            quorum_store_commit_sender: Mutex::new(dummy_sender),
-            quorum_store_commit_timeout_ms,
-        }
-    }
-}
-
-#[async_trait::async_trait]
-impl CommitNotifier for QuorumStoreCommitNotifier {
-    async fn notify_commit(&self, epoch: u64, round: Round) -> Result<(), QuorumStoreError> {
-        let (callback, callback_rcv) = oneshot::channel();
-        let req = ConsensusRequest::CleanRequest(epoch, round, callback);
-
-        self.quorum_store_commit_sender
-            .lock()
-            .clone()
-            .try_send(req)
-            .map_err(anyhow::Error::from)?;
-
-        if let Err(e) = monitor!(
-            "notify_commit",
-            timeout(
-                Duration::from_millis(self.quorum_store_commit_timeout_ms),
-                callback_rcv
-            )
-            .await
-        ) {
-            Err(format_err!(
-                "[consensus] quorum store commit notifier did not receive ACK on time: {:?}",
-                e
-            )
-            .into())
-        } else {
-            Ok(())
-        }
-    }
-
-    fn new_epoch(&self, quorum_store_commit_sender: Sender) {
-        *self.quorum_store_commit_sender.lock() = quorum_store_commit_sender;
-    }
-}
diff --git a/consensus/src/consensus_provider.rs b/consensus/src/consensus_provider.rs
index 17eb923a0e0eb..403e458dbb9dd 100644
--- a/consensus/src/consensus_provider.rs
+++ b/consensus/src/consensus_provider.rs
@@ -2,7 +2,6 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::{
-    commit_notifier::QuorumStoreCommitNotifier,
     counters,
     epoch_manager::EpochManager,
     network::NetworkTask,
@@ -13,12 +12,12 @@ use crate::{
     util::time_service::ClockTimeService,
 };
 use aptos_config::config::NodeConfig;
+use aptos_consensus_notifications::ConsensusNotificationSender;
+use aptos_event_notifications::ReconfigNotificationListener;
+use aptos_executor::block_executor::BlockExecutor;
 use aptos_logger::prelude::*;
 use aptos_mempool::QuorumStoreRequest;
 use aptos_vm::AptosVM;
-use consensus_notifications::ConsensusNotificationSender;
-use event_notifications::ReconfigNotificationListener;
-use executor::block_executor::BlockExecutor;
 use futures::channel::mpsc;
 use network::application::storage::PeerMetadataStorage;
 use std::sync::{
@@ -54,15 +53,11 @@ pub fn start_consensus(
         consensus_to_mempool_sender.clone(),
         node_config.consensus.mempool_executed_txn_timeout_ms,
     ));
-    let commit_notifier = Arc::new(QuorumStoreCommitNotifier::new(
-        node_config.consensus.quorum_store_pull_timeout_ms,
-    ));
 
     let state_computer = Arc::new(ExecutionProxy::new(
         Arc::new(BlockExecutor::::new(aptos_db)),
         txn_notifier,
         state_sync_notifier,
-        commit_notifier.clone(),
         runtime.handle(),
     ));
 
@@ -82,7 +77,6 @@ pub fn start_consensus(
         state_computer,
         storage,
         reconfig_events,
-        commit_notifier,
     );
 
     let (network_task, network_receiver) = NetworkTask::new(network_events, self_receiver);
diff --git a/consensus/src/consensusdb/consensusdb_test.rs b/consensus/src/consensusdb/consensusdb_test.rs
index ad8cb2048c766..db651570214ab 100644
--- a/consensus/src/consensusdb/consensusdb_test.rs
+++ b/consensus/src/consensusdb/consensusdb_test.rs
@@ -2,8 +2,8 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use super::*;
+use aptos_consensus_types::block::block_test_utils::certificate_for_genesis;
 use aptos_temppath::TempPath;
-use consensus_types::block::block_test_utils::certificate_for_genesis;
 
 #[test]
 fn test_put_get() {
diff --git a/consensus/src/consensusdb/mod.rs b/consensus/src/consensusdb/mod.rs
index 68376da86aabd..8d92a1681e71c 100644
--- a/consensus/src/consensusdb/mod.rs
+++ b/consensus/src/consensusdb/mod.rs
@@ -14,9 +14,9 @@ use crate::{
     error::DbError,
 };
 use anyhow::Result;
+use aptos_consensus_types::{block::Block, quorum_cert::QuorumCert};
 use aptos_crypto::HashValue;
 use aptos_logger::prelude::*;
-use consensus_types::{block::Block, quorum_cert::QuorumCert};
 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};
diff --git a/consensus/src/consensusdb/schema/block/mod.rs b/consensus/src/consensusdb/schema/block/mod.rs
index 7fb4cc6e7ef0a..c7ee5b7b53492 100644
--- a/consensus/src/consensusdb/schema/block/mod.rs
+++ b/consensus/src/consensusdb/schema/block/mod.rs
@@ -11,8 +11,8 @@
 
 use super::BLOCK_CF_NAME;
 use anyhow::Result;
+use aptos_consensus_types::block::Block;
 use aptos_crypto::HashValue;
-use consensus_types::block::Block;
 use schemadb::schema::{KeyCodec, Schema, ValueCodec};
 
 #[derive(Debug)]
diff --git a/consensus/src/consensusdb/schema/quorum_certificate/mod.rs b/consensus/src/consensusdb/schema/quorum_certificate/mod.rs
index 97690ea84b134..9977e7e5d8c6e 100644
--- a/consensus/src/consensusdb/schema/quorum_certificate/mod.rs
+++ b/consensus/src/consensusdb/schema/quorum_certificate/mod.rs
@@ -11,8 +11,8 @@
 
 use super::QC_CF_NAME;
 use anyhow::Result;
+use aptos_consensus_types::quorum_cert::QuorumCert;
 use aptos_crypto::HashValue;
-use consensus_types::quorum_cert::QuorumCert;
 use 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 ef89cbb438b92..e3eaee95036d3 100644
--- a/consensus/src/consensusdb/schema/quorum_certificate/test.rs
+++ b/consensus/src/consensusdb/schema/quorum_certificate/test.rs
@@ -2,7 +2,7 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use super::*;
-use consensus_types::block::block_test_utils::certificate_for_genesis;
+use aptos_consensus_types::block::block_test_utils::certificate_for_genesis;
 use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding};
 
 #[test]
diff --git a/consensus/src/epoch_manager.rs b/consensus/src/epoch_manager.rs
index eede4aff646dc..1273162e20d5b 100644
--- a/consensus/src/epoch_manager.rs
+++ b/consensus/src/epoch_manager.rs
@@ -6,7 +6,6 @@ use crate::{
         tracing::{observe_block, BlockStage},
         BlockStore,
     },
-    commit_notifier::CommitNotifier,
     counters,
     error::{error_kind, DbError},
     experimental::{
@@ -31,7 +30,8 @@ use crate::{
     monitor,
     network::{IncomingBlockRetrievalRequest, NetworkReceivers, NetworkSender},
     network_interface::{ConsensusMsg, ConsensusNetworkSender},
-    payload_manager::QuorumStoreClient,
+    payload_client::QuorumStoreClient,
+    payload_manager::PayloadManager,
     persistent_liveness_storage::{LedgerRecoveryData, PersistentLivenessStorage, RecoveryData},
     quorum_store::direct_mempool_quorum_store::DirectMempoolQuorumStore,
     recovery_manager::RecoveryManager,
@@ -41,6 +41,12 @@ use crate::{
 };
 use anyhow::{bail, ensure, Context};
 use aptos_config::config::{ConsensusConfig, NodeConfig};
+use aptos_consensus_types::{
+    common::{Author, Round},
+    epoch_retrieval::EpochRetrievalRequest,
+    request_response::PayloadRequest,
+};
+use aptos_event_notifications::ReconfigNotificationListener;
 use aptos_infallible::{duration_since_epoch, Mutex};
 use aptos_logger::prelude::*;
 use aptos_mempool::QuorumStoreRequest;
@@ -55,12 +61,6 @@ use aptos_types::{
     validator_verifier::ValidatorVerifier,
 };
 use channel::{aptos_channel, message_queues::QueueStyle};
-use consensus_types::{
-    common::{Author, Round},
-    epoch_retrieval::EpochRetrievalRequest,
-    request_response::ConsensusRequest,
-};
-use event_notifications::ReconfigNotificationListener;
 use fail::fail_point;
 use futures::{
     channel::{
@@ -103,12 +103,12 @@ pub struct EpochManager {
     self_sender: channel::Sender>,
     network_sender: ConsensusNetworkSender,
     timeout_sender: channel::Sender,
+    quorum_store_enabled: bool,
     quorum_store_to_mempool_sender: Sender,
     commit_state_computer: Arc,
     storage: Arc,
     safety_rules_manager: SafetyRulesManager,
     reconfig_events: ReconfigNotificationListener,
-    commit_notifier: Arc,
     // channels to buffer manager
     buffer_manager_msg_tx: Option>,
     buffer_manager_reset_tx: Option>,
@@ -133,7 +133,6 @@ impl EpochManager {
         commit_state_computer: Arc,
         storage: Arc,
         reconfig_events: ReconfigNotificationListener,
-        commit_notifier: Arc,
     ) -> Self {
         let author = node_config.validator_network.as_ref().unwrap().peer_id();
         let config = node_config.consensus.clone();
@@ -146,12 +145,12 @@ impl EpochManager {
             self_sender,
             network_sender,
             timeout_sender,
+            quorum_store_enabled: false, // TODO: read form on chain config
             quorum_store_to_mempool_sender,
             commit_state_computer,
             storage,
             safety_rules_manager,
             reconfig_events,
-            commit_notifier,
             buffer_manager_msg_tx: None,
             buffer_manager_reset_tx: None,
             round_manager_tx: None,
@@ -429,9 +428,9 @@ impl EpochManager {
         Ok(())
     }
 
-    fn spawn_quorum_store(
+    fn spawn_direct_mempool_quorum_store(
         &mut self,
-        consensus_to_quorum_store_receiver: Receiver,
+        consensus_to_quorum_store_receiver: Receiver,
     ) {
         let quorum_store = DirectMempoolQuorumStore::new(
             consensus_to_quorum_store_receiver,
@@ -576,6 +575,7 @@ impl EpochManager {
         recovery_data: RecoveryData,
         epoch_state: EpochState,
         onchain_config: OnChainConsensusConfig,
+        quorum_store_enabled: bool,
     ) {
         let epoch = epoch_state.epoch;
         counters::EPOCH.set(epoch_state.epoch as i64);
@@ -616,18 +616,10 @@ impl EpochManager {
             ChainHealthBackoffConfig::new(self.config.chain_health_backoff.clone());
         let safety_rules_container = Arc::new(Mutex::new(safety_rules));
 
-        let (consensus_to_quorum_store_sender, consensus_to_quorum_store_receiver) =
-            mpsc::channel(self.config.intra_consensus_channel_buffer_size);
-        self.spawn_quorum_store(consensus_to_quorum_store_receiver);
-        let payload_manager = QuorumStoreClient::new(
-            consensus_to_quorum_store_sender.clone(),
-            self.config.quorum_store_poll_count,
-            self.config.quorum_store_pull_timeout_ms,
-        );
-        self.commit_notifier
-            .new_epoch(consensus_to_quorum_store_sender);
+        let payload_manager = Arc::from(PayloadManager::DirectMempool); // TODO: check if QuorumStore is enabled.
 
-        self.commit_state_computer.new_epoch(&epoch_state);
+        self.commit_state_computer
+            .new_epoch(&epoch_state, payload_manager.clone());
         let state_computer = if onchain_config.decoupled_execution() {
             Arc::new(self.spawn_decoupled_execution(
                 safety_rules_container.clone(),
@@ -645,20 +637,33 @@ impl EpochManager {
             self.config.max_pruned_blocks_in_mem,
             Arc::clone(&self.time_service),
             onchain_config.back_pressure_limit(),
+            payload_manager,
         ));
 
+        // Start QuorumStore
+        let (consensus_to_quorum_store_tx, consensus_to_quorum_store_rx) =
+            mpsc::channel(self.config.intra_consensus_channel_buffer_size);
+        self.spawn_direct_mempool_quorum_store(consensus_to_quorum_store_rx);
+
+        let payload_client = QuorumStoreClient::new(
+            consensus_to_quorum_store_tx,
+            self.config.quorum_store_poll_count, // TODO: consider moving it to a quorum store config in later PRs.
+            self.config.quorum_store_pull_timeout_ms,
+        );
+
         info!(epoch = epoch, "Create ProposalGenerator");
         // txn manager is required both by proposal generator (to pull the proposers)
         // and by event processor (to update their status).
         let proposal_generator = ProposalGenerator::new(
             self.author,
             block_store.clone(),
-            Arc::new(payload_manager),
+            Arc::new(payload_client),
             self.time_service.clone(),
             self.config.max_sending_block_txns,
             self.config.max_sending_block_bytes,
             onchain_config.max_failed_authors_to_store(),
             chain_health_backoff_config,
+            quorum_store_enabled,
         );
 
         let (round_manager_tx, round_manager_rx) = aptos_channel::new(
@@ -722,6 +727,7 @@ impl EpochManager {
                     initial_data,
                     epoch_state,
                     onchain_config.unwrap_or_default(),
+                    self.quorum_store_enabled,
                 )
                 .await
             }
@@ -755,7 +761,7 @@ impl EpochManager {
                 "verify_message",
                 unverified_event
                     .clone()
-                    .verify(&self.epoch_state().verifier)
+                    .verify(&self.epoch_state().verifier, self.quorum_store_enabled)
             )
             .context("[EpochManager] Verify event")
             .map_err(|err| {
diff --git a/consensus/src/error.rs b/consensus/src/error.rs
index 041ba3dc1073a..39d3d36dbe3fe 100644
--- a/consensus/src/error.rs
+++ b/consensus/src/error.rs
@@ -24,8 +24,8 @@ impl From for StateSyncError {
     }
 }
 
-impl From for StateSyncError {
-    fn from(e: executor_types::Error) -> Self {
+impl From for StateSyncError {
+    fn from(e: aptos_executor_types::Error) -> Self {
         StateSyncError { inner: e.into() }
     }
 }
@@ -52,11 +52,14 @@ pub struct VerifyError {
 }
 
 pub fn error_kind(e: &anyhow::Error) -> &'static str {
-    if e.downcast_ref::().is_some() {
+    if e.downcast_ref::().is_some() {
         return "Execution";
     }
     if let Some(e) = e.downcast_ref::() {
-        if e.inner.downcast_ref::().is_some() {
+        if e.inner
+            .downcast_ref::()
+            .is_some()
+        {
             return "Execution";
         }
         return "StateSync";
@@ -86,7 +89,7 @@ mod tests {
 
     #[test]
     fn conversion_and_downcast() {
-        let error = executor_types::Error::InternalError {
+        let error = aptos_executor_types::Error::InternalError {
             error: "lalala".to_string(),
         };
         let typed_error: StateSyncError = error.into();
diff --git a/consensus/src/experimental/buffer_item.rs b/consensus/src/experimental/buffer_item.rs
index b247ab880a636..fa600a8d75415 100644
--- a/consensus/src/experimental/buffer_item.rs
+++ b/consensus/src/experimental/buffer_item.rs
@@ -4,6 +4,9 @@
 use anyhow::anyhow;
 use itertools::zip_eq;
 
+use aptos_consensus_types::{
+    common::Author, executed_block::ExecutedBlock, experimental::commit_vote::CommitVote,
+};
 use aptos_crypto::bls12381;
 use aptos_logger::prelude::*;
 use aptos_types::{
@@ -11,9 +14,6 @@ use aptos_types::{
     ledger_info::{LedgerInfo, LedgerInfoWithSignatures},
     validator_verifier::ValidatorVerifier,
 };
-use consensus_types::{
-    common::Author, executed_block::ExecutedBlock, experimental::commit_vote::CommitVote,
-};
 
 use crate::{experimental::hashable::Hashable, state_replication::StateComputerCommitCallBackType};
 use aptos_crypto::HashValue;
diff --git a/consensus/src/experimental/buffer_manager.rs b/consensus/src/experimental/buffer_manager.rs
index d0c20ff89bc1d..785305c53cf9a 100644
--- a/consensus/src/experimental/buffer_manager.rs
+++ b/consensus/src/experimental/buffer_manager.rs
@@ -15,12 +15,12 @@ use futures::{
 };
 use tokio::time::{Duration, Instant};
 
+use aptos_consensus_types::{common::Author, executed_block::ExecutedBlock};
 use aptos_logger::prelude::*;
 use aptos_types::{
     account_address::AccountAddress, ledger_info::LedgerInfoWithSignatures,
     validator_verifier::ValidatorVerifier,
 };
-use consensus_types::{common::Author, executed_block::ExecutedBlock};
 
 use crate::{
     block_storage::tracing::{observe_block, BlockStage},
diff --git a/consensus/src/experimental/decoupled_execution_utils.rs b/consensus/src/experimental/decoupled_execution_utils.rs
index cc24bc5fa3326..7d30aa6bef67b 100644
--- a/consensus/src/experimental/decoupled_execution_utils.rs
+++ b/consensus/src/experimental/decoupled_execution_utils.rs
@@ -14,10 +14,10 @@ use crate::{
     round_manager::VerifiedEvent,
     state_replication::StateComputer,
 };
+use aptos_consensus_types::common::Author;
 use aptos_infallible::Mutex;
 use aptos_types::{account_address::AccountAddress, validator_verifier::ValidatorVerifier};
 use channel::aptos_channel::Receiver;
-use consensus_types::common::Author;
 use futures::channel::mpsc::UnboundedReceiver;
 use std::sync::{atomic::AtomicU64, Arc};
 
diff --git a/consensus/src/experimental/execution_phase.rs b/consensus/src/experimental/execution_phase.rs
index 0d0c425bbc257..69f946565c36e 100644
--- a/consensus/src/experimental/execution_phase.rs
+++ b/consensus/src/experimental/execution_phase.rs
@@ -3,10 +3,10 @@
 
 use crate::{experimental::pipeline_phase::StatelessPipeline, state_replication::StateComputer};
 use anyhow::Result;
+use aptos_consensus_types::executed_block::ExecutedBlock;
 use aptos_crypto::HashValue;
+use aptos_executor_types::Error as ExecutionError;
 use async_trait::async_trait;
-use consensus_types::executed_block::ExecutedBlock;
-use executor_types::Error as ExecutionError;
 use std::{
     fmt::{Debug, Display, Formatter},
     sync::Arc,
diff --git a/consensus/src/experimental/ordering_state_computer.rs b/consensus/src/experimental/ordering_state_computer.rs
index d3b068b1a9934..bd0d4f6ec86f9 100644
--- a/consensus/src/experimental/ordering_state_computer.rs
+++ b/consensus/src/experimental/ordering_state_computer.rs
@@ -1,6 +1,7 @@
 // Copyright (c) Aptos
 // SPDX-License-Identifier: Apache-2.0
 
+use crate::payload_manager::PayloadManager;
 use crate::{
     error::StateSyncError,
     experimental::{
@@ -10,11 +11,11 @@ use crate::{
     state_replication::{StateComputer, StateComputerCommitCallBackType},
 };
 use anyhow::Result;
+use aptos_consensus_types::{block::Block, executed_block::ExecutedBlock};
 use aptos_crypto::HashValue;
+use aptos_executor_types::{Error as ExecutionError, StateComputeResult};
 use aptos_logger::prelude::*;
 use aptos_types::{epoch_state::EpochState, ledger_info::LedgerInfoWithSignatures};
-use consensus_types::{block::Block, executed_block::ExecutedBlock};
-use executor_types::{Error as ExecutionError, StateComputeResult};
 use fail::fail_point;
 use futures::{
     channel::{mpsc::UnboundedSender, oneshot},
@@ -117,5 +118,5 @@ impl StateComputer for OrderingStateComputer {
         Ok(())
     }
 
-    fn new_epoch(&self, _: &EpochState) {}
+    fn new_epoch(&self, _: &EpochState, _payload_manager: Arc) {}
 }
diff --git a/consensus/src/experimental/persisting_phase.rs b/consensus/src/experimental/persisting_phase.rs
index 40cfd1bfb7468..746c78561142d 100644
--- a/consensus/src/experimental/persisting_phase.rs
+++ b/consensus/src/experimental/persisting_phase.rs
@@ -10,10 +10,10 @@ use crate::{
     experimental::pipeline_phase::StatelessPipeline,
     state_replication::{StateComputer, StateComputerCommitCallBackType},
 };
+use aptos_consensus_types::executed_block::ExecutedBlock;
+use aptos_executor_types::Error;
 use aptos_types::ledger_info::LedgerInfoWithSignatures;
 use async_trait::async_trait;
-use consensus_types::executed_block::ExecutedBlock;
-use executor_types::Error;
 
 /// [ This class is used when consensus.decoupled = true ]
 /// PersistingPhase is a singleton that receives aggregated blocks from
diff --git a/consensus/src/experimental/tests/buffer_manager_tests.rs b/consensus/src/experimental/tests/buffer_manager_tests.rs
index d2166ec1cbaca..ad368fefb85f5 100644
--- a/consensus/src/experimental/tests/buffer_manager_tests.rs
+++ b/consensus/src/experimental/tests/buffer_manager_tests.rs
@@ -23,6 +23,10 @@ use crate::{
         RandomComputeResultStateComputer,
     },
 };
+use aptos_consensus_types::{
+    block::block_test_utils::certificate_for_genesis, executed_block::ExecutedBlock,
+    vote_proposal::VoteProposal,
+};
 use aptos_crypto::{hash::ACCUMULATOR_PLACEHOLDER_HASH, HashValue};
 use aptos_infallible::Mutex;
 use aptos_secure_storage::Storage;
@@ -34,10 +38,6 @@ use aptos_types::{
     waypoint::Waypoint,
 };
 use channel::{aptos_channel, message_queues::QueueStyle};
-use consensus_types::{
-    block::block_test_utils::certificate_for_genesis, executed_block::ExecutedBlock,
-    vote_proposal::VoteProposal,
-};
 use futures::{channel::oneshot, FutureExt, SinkExt, StreamExt};
 use itertools::enumerate;
 use network::{
@@ -205,7 +205,9 @@ async fn loopback_commit_vote(
             if matches!(msg, ConsensusMsg::CommitVoteMsg(_)) {
                 let event: UnverifiedEvent = msg.into();
                 // verify the message and send the message into self loop
-                msg_tx.push(author, event.verify(verifier).unwrap()).ok();
+                msg_tx
+                    .push(author, event.verify(verifier, false).unwrap())
+                    .ok();
             }
         }
         _ => {
diff --git a/consensus/src/experimental/tests/execution_phase_tests.rs b/consensus/src/experimental/tests/execution_phase_tests.rs
index d1318d3b6c654..77b081242f6f5 100644
--- a/consensus/src/experimental/tests/execution_phase_tests.rs
+++ b/consensus/src/experimental/tests/execution_phase_tests.rs
@@ -10,15 +10,15 @@ use crate::{
     },
     test_utils::{consensus_runtime, RandomComputeResultStateComputer},
 };
-use aptos_crypto::HashValue;
-use aptos_types::{ledger_info::LedgerInfo, validator_verifier::random_validator_verifier};
-use consensus_types::{
+use aptos_consensus_types::{
     block::{block_test_utils::certificate_for_genesis, Block},
     common::Payload,
     executed_block::ExecutedBlock,
     quorum_cert::QuorumCert,
 };
-use executor_types::{Error, StateComputeResult};
+use aptos_crypto::HashValue;
+use aptos_executor_types::{Error, StateComputeResult};
+use aptos_types::{ledger_info::LedgerInfo, validator_verifier::random_validator_verifier};
 use std::sync::Arc;
 
 pub fn prepare_execution_phase() -> (HashValue, ExecutionPhase) {
@@ -34,8 +34,15 @@ fn add_execution_phase_test_cases(
 ) {
     let genesis_qc = certificate_for_genesis();
     let (signers, _validators) = random_validator_verifier(1, None, false);
-    let block =
-        Block::new_proposal(Payload::empty(), 1, 1, genesis_qc, &signers[0], Vec::new()).unwrap();
+    let block = Block::new_proposal(
+        Payload::empty(false),
+        1,
+        1,
+        genesis_qc,
+        &signers[0],
+        Vec::new(),
+    )
+    .unwrap();
 
     // happy path
     phase_tester.add_test_case(
@@ -64,7 +71,7 @@ fn add_execution_phase_test_cases(
         random_hash_value,
     );
     let bad_block =
-        Block::new_proposal(Payload::empty(), 1, 1, bad_qc, &signers[0], Vec::new()).unwrap();
+        Block::new_proposal(Payload::empty(false), 1, 1, bad_qc, &signers[0], Vec::new()).unwrap();
     phase_tester.add_test_case(
         ExecutionRequest {
             ordered_blocks: vec![ExecutedBlock::new(
diff --git a/consensus/src/experimental/tests/test_utils.rs b/consensus/src/experimental/tests/test_utils.rs
index d5e1e12187a21..2809bccdf534b 100644
--- a/consensus/src/experimental/tests/test_utils.rs
+++ b/consensus/src/experimental/tests/test_utils.rs
@@ -2,7 +2,15 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::{metrics_safety_rules::MetricsSafetyRules, test_utils::MockStorage};
+use aptos_consensus_types::{
+    block::block_test_utils::certificate_for_genesis,
+    common::{Payload, Round},
+    executed_block::ExecutedBlock,
+    quorum_cert::QuorumCert,
+    vote_proposal::VoteProposal,
+};
 use aptos_crypto::{hash::ACCUMULATOR_PLACEHOLDER_HASH, HashValue};
+use aptos_executor_types::StateComputeResult;
 use aptos_infallible::Mutex;
 use aptos_secure_storage::Storage;
 use aptos_types::{
@@ -11,14 +19,6 @@ use aptos_types::{
     validator_verifier::random_validator_verifier,
     waypoint::Waypoint,
 };
-use consensus_types::{
-    block::block_test_utils::certificate_for_genesis,
-    common::{Payload, Round},
-    executed_block::ExecutedBlock,
-    quorum_cert::QuorumCert,
-    vote_proposal::VoteProposal,
-};
-use executor_types::StateComputeResult;
 use safety_rules::{
     test_utils::{make_proposal_with_parent, make_proposal_with_qc},
     PersistentSafetyStorage, SafetyRulesManager,
@@ -69,7 +69,7 @@ pub fn prepare_executed_blocks_with_ledger_info(
     assert!(num_blocks > 0);
 
     let p1 = if let Some(parent) = some_parent {
-        make_proposal_with_parent(Payload::empty(), init_round, &parent, None, signer)
+        make_proposal_with_parent(Payload::empty(false), init_round, &parent, None, signer)
     } else {
         make_proposal_with_qc(init_round, init_qc.unwrap(), signer)
     };
@@ -80,7 +80,7 @@ pub fn prepare_executed_blocks_with_ledger_info(
         println!("Generating {}", i);
         let parent = proposals.last().unwrap();
         let proposal =
-            make_proposal_with_parent(Payload::empty(), init_round + i, parent, None, signer);
+            make_proposal_with_parent(Payload::empty(false), init_round + i, parent, None, signer);
         proposals.push(proposal);
     }
 
diff --git a/consensus/src/lib.rs b/consensus/src/lib.rs
index 05e7dacfec6aa..a8ce349405454 100644
--- a/consensus/src/lib.rs
+++ b/consensus/src/lib.rs
@@ -15,7 +15,6 @@
 extern crate core;
 
 mod block_storage;
-mod commit_notifier;
 mod consensusdb;
 mod epoch_manager;
 mod error;
@@ -26,7 +25,7 @@ mod metrics_safety_rules;
 mod network;
 #[cfg(test)]
 mod network_tests;
-mod payload_manager;
+mod payload_client;
 mod pending_votes;
 mod persistent_liveness_storage;
 mod quorum_store;
@@ -47,6 +46,7 @@ pub mod consensus_provider;
 pub mod counters;
 /// AptosNet interface.
 pub mod network_interface;
+mod payload_manager;
 
 /// Required by the smoke tests
 pub use consensusdb::CONSENSUS_DB_NAME;
diff --git a/consensus/src/liveness/cached_proposer_election.rs b/consensus/src/liveness/cached_proposer_election.rs
index 44e2b72eb68cc..e65e4f770ea71 100644
--- a/consensus/src/liveness/cached_proposer_election.rs
+++ b/consensus/src/liveness/cached_proposer_election.rs
@@ -3,9 +3,9 @@
 
 use std::collections::BTreeMap;
 
+use aptos_consensus_types::common::{Author, Round};
 use aptos_infallible::Mutex;
 use aptos_logger::prelude::info;
-use consensus_types::common::{Author, Round};
 
 use crate::counters::PROPOSER_ELECTION_DURATION;
 
diff --git a/consensus/src/liveness/cached_proposer_election_test.rs b/consensus/src/liveness/cached_proposer_election_test.rs
index 14f1dbc86ba1a..1adb28249b592 100644
--- a/consensus/src/liveness/cached_proposer_election_test.rs
+++ b/consensus/src/liveness/cached_proposer_election_test.rs
@@ -3,8 +3,8 @@
 
 use std::{cell::Cell, sync::Arc};
 
+use aptos_consensus_types::common::{Author, Round};
 use aptos_infallible::Mutex;
-use consensus_types::common::{Author, Round};
 
 use crate::liveness::cached_proposer_election::CachedProposerElection;
 
diff --git a/consensus/src/liveness/leader_reputation.rs b/consensus/src/liveness/leader_reputation.rs
index 22e53f13496c0..e60e39223e69c 100644
--- a/consensus/src/liveness/leader_reputation.rs
+++ b/consensus/src/liveness/leader_reputation.rs
@@ -13,6 +13,7 @@ use crate::{
 };
 use anyhow::{ensure, Result};
 use aptos_bitvec::BitVec;
+use aptos_consensus_types::common::{Author, Round};
 use aptos_crypto::HashValue;
 use aptos_infallible::{Mutex, MutexGuard};
 use aptos_logger::prelude::*;
@@ -21,7 +22,6 @@ use aptos_types::{
     epoch_change::EpochChangeProof,
     epoch_state::EpochState,
 };
-use consensus_types::common::{Author, Round};
 use std::{
     collections::{HashMap, HashSet},
     convert::TryFrom,
diff --git a/consensus/src/liveness/leader_reputation_test.rs b/consensus/src/liveness/leader_reputation_test.rs
index 09607bd933732..2ae9f411bb047 100644
--- a/consensus/src/liveness/leader_reputation_test.rs
+++ b/consensus/src/liveness/leader_reputation_test.rs
@@ -11,6 +11,7 @@ use crate::liveness::{
     proposer_election::{choose_index, ProposerElection},
 };
 use aptos_bitvec::BitVec;
+use aptos_consensus_types::common::{Author, Round};
 use aptos_crypto::{bls12381, HashValue};
 use aptos_infallible::Mutex;
 use aptos_keygen::KeyGen;
@@ -24,7 +25,6 @@ use aptos_types::{
     validator_verifier::{ValidatorConsensusInfo, ValidatorVerifier},
 };
 use claims::assert_err;
-use consensus_types::common::{Author, Round};
 use itertools::Itertools;
 use move_core_types::{language_storage::TypeTag, move_resource::MoveStructType};
 use num_traits::Pow;
diff --git a/consensus/src/liveness/proposal_generator.rs b/consensus/src/liveness/proposal_generator.rs
index 80732b362ba86..574c76cd5dea1 100644
--- a/consensus/src/liveness/proposal_generator.rs
+++ b/consensus/src/liveness/proposal_generator.rs
@@ -3,19 +3,19 @@
 
 use crate::{
     block_storage::BlockReader, counters::CHAIN_HEALTH_BACKOFF_TRIGGERED,
-    state_replication::PayloadManager, util::time_service::TimeService,
+    state_replication::PayloadClient, util::time_service::TimeService,
 };
 use anyhow::{bail, ensure, format_err, Context};
 use aptos_config::config::ChainHealthBackoffValues;
-use aptos_logger::{error, sample, sample::SampleRate, warn};
-use consensus_types::{
+use aptos_consensus_types::{
     block::Block,
     block_data::BlockData,
     common::{Author, Round},
     quorum_cert::QuorumCert,
 };
+use aptos_logger::{error, sample, sample::SampleRate, warn};
 
-use consensus_types::common::{Payload, PayloadFilter};
+use aptos_consensus_types::common::{Payload, PayloadFilter};
 use futures::future::BoxFuture;
 use std::{collections::BTreeMap, sync::Arc, time::Duration};
 
@@ -102,7 +102,7 @@ pub struct ProposalGenerator {
     // proposed block.
     block_store: Arc,
     // ProofOfStore manager is delivering the ProofOfStores.
-    payload_manager: Arc,
+    payload_client: Arc,
     // Transaction manager is delivering the transactions.
     // Time service to generate block timestamps
     time_service: Arc,
@@ -117,29 +117,32 @@ pub struct ProposalGenerator {
 
     // Last round that a proposal was generated
     last_round_generated: Round,
+    quorum_store_enabled: bool,
 }
 
 impl ProposalGenerator {
     pub fn new(
         author: Author,
         block_store: Arc,
-        payload_manager: Arc,
+        payload_client: Arc,
         time_service: Arc,
         max_block_txns: u64,
         max_block_bytes: u64,
         max_failed_authors_to_store: usize,
         chain_health_backoff_config: ChainHealthBackoffConfig,
+        quorum_store_enabled: bool,
     ) -> Self {
         Self {
             author,
             block_store,
-            payload_manager,
+            payload_client,
             time_service,
             max_block_txns,
             max_block_bytes,
             max_failed_authors_to_store,
             chain_health_backoff_config,
             last_round_generated: 0,
+            quorum_store_enabled,
         }
     }
 
@@ -195,7 +198,10 @@ impl ProposalGenerator {
         let (payload, timestamp) = if hqc.certified_block().has_reconfiguration() {
             // Reconfiguration rule - we propose empty blocks with parents' timestamp
             // after reconfiguration until it's committed
-            (Payload::empty(), hqc.certified_block().timestamp_usecs())
+            (
+                Payload::empty(self.quorum_store_enabled),
+                hqc.certified_block().timestamp_usecs(),
+            )
         } else {
             // One needs to hold the blocks with the references to the payloads while get_block is
             // being executed: pending blocks vector keeps all the pending ancestors of the extended branch.
@@ -247,8 +253,9 @@ impl ProposalGenerator {
             };
 
             let payload = self
-                .payload_manager
+                .payload_client
                 .pull_payload(
+                    round,
                     max_block_txns,
                     max_block_bytes,
                     payload_filter,
diff --git a/consensus/src/liveness/proposal_generator_test.rs b/consensus/src/liveness/proposal_generator_test.rs
index c1e0212ea870f..46fe0402bbc43 100644
--- a/consensus/src/liveness/proposal_generator_test.rs
+++ b/consensus/src/liveness/proposal_generator_test.rs
@@ -11,11 +11,11 @@ use crate::{
     test_utils::{build_empty_tree, MockPayloadManager, TreeInserter},
     util::mock_time_service::SimulatedTimeService,
 };
-use aptos_types::validator_signer::ValidatorSigner;
-use consensus_types::{
+use aptos_consensus_types::{
     block::{block_test_utils::certificate_for_genesis, Block},
     common::Author,
 };
+use aptos_types::validator_signer::ValidatorSigner;
 use futures::{future::BoxFuture, FutureExt};
 use std::sync::Arc;
 
@@ -36,6 +36,7 @@ async fn test_proposal_generation_empty_tree() {
         10,
         10,
         ChainHealthBackoffConfig::new_no_backoff(),
+        false,
     );
     let mut proposer_election =
         UnequivocalProposerElection::new(Box::new(RotatingProposer::new(vec![signer.author()], 1)));
@@ -73,6 +74,7 @@ async fn test_proposal_generation_parent() {
         1000,
         10,
         ChainHealthBackoffConfig::new_no_backoff(),
+        false,
     );
     let mut proposer_election = UnequivocalProposerElection::new(Box::new(RotatingProposer::new(
         vec![inserter.signer().author()],
@@ -142,6 +144,7 @@ async fn test_old_proposal_generation() {
         1000,
         10,
         ChainHealthBackoffConfig::new_no_backoff(),
+        false,
     );
     let mut proposer_election = UnequivocalProposerElection::new(Box::new(RotatingProposer::new(
         vec![inserter.signer().author()],
@@ -176,6 +179,7 @@ async fn test_correct_failed_authors() {
         1000,
         10,
         ChainHealthBackoffConfig::new_no_backoff(),
+        false,
     );
     let mut proposer_election = UnequivocalProposerElection::new(Box::new(RotatingProposer::new(
         vec![author, peer1, peer2],
diff --git a/consensus/src/liveness/proposer_election.rs b/consensus/src/liveness/proposer_election.rs
index 4f827ba5a04f4..f22698bdcd512 100644
--- a/consensus/src/liveness/proposer_election.rs
+++ b/consensus/src/liveness/proposer_election.rs
@@ -3,8 +3,8 @@
 
 use std::cmp::Ordering;
 
-use consensus_types::common::{Author, Round};
-use fallible::copy_from_slice::copy_slice_to_vec;
+use aptos_consensus_types::common::{Author, Round};
+use aptos_fallible::copy_from_slice::copy_slice_to_vec;
 use num_traits::CheckedAdd;
 
 /// ProposerElection incorporates the logic of choosing a leader among multiple candidates.
diff --git a/consensus/src/liveness/rotating_proposer_election.rs b/consensus/src/liveness/rotating_proposer_election.rs
index 5850713af2d51..e8b256ac1c8f6 100644
--- a/consensus/src/liveness/rotating_proposer_election.rs
+++ b/consensus/src/liveness/rotating_proposer_election.rs
@@ -2,7 +2,7 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::liveness::proposer_election::ProposerElection;
-use consensus_types::common::{Author, Round};
+use aptos_consensus_types::common::{Author, Round};
 
 /// The rotating proposer maps a round to an author according to a round-robin rotation.
 /// A fixed proposer strategy loses liveness when the fixed proposer is down. Rotating proposers
diff --git a/consensus/src/liveness/round_proposer_election.rs b/consensus/src/liveness/round_proposer_election.rs
index e6cb6fee62ed8..892219a0e8251 100644
--- a/consensus/src/liveness/round_proposer_election.rs
+++ b/consensus/src/liveness/round_proposer_election.rs
@@ -2,7 +2,7 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::liveness::proposer_election::ProposerElection;
-use consensus_types::common::{Author, Round};
+use aptos_consensus_types::common::{Author, Round};
 
 use std::collections::HashMap;
 
diff --git a/consensus/src/liveness/round_proposer_test.rs b/consensus/src/liveness/round_proposer_test.rs
index 0cc91e4d2d64e..aad1cb04ba753 100644
--- a/consensus/src/liveness/round_proposer_test.rs
+++ b/consensus/src/liveness/round_proposer_test.rs
@@ -6,7 +6,7 @@ use crate::liveness::{
 };
 use aptos_types::account_address::AccountAddress;
 
-use consensus_types::common::{Author, Round};
+use aptos_consensus_types::common::{Author, Round};
 use std::collections::HashMap;
 
 #[test]
diff --git a/consensus/src/liveness/round_state.rs b/consensus/src/liveness/round_state.rs
index 58b4de875a18e..d973f74bb9d88 100644
--- a/consensus/src/liveness/round_state.rs
+++ b/consensus/src/liveness/round_state.rs
@@ -6,13 +6,13 @@ use crate::{
     pending_votes::{PendingVotes, VoteReceptionResult},
     util::time_service::{SendTask, TimeService},
 };
+use aptos_consensus_types::timeout_2chain::TwoChainTimeoutWithPartialSignatures;
+use aptos_consensus_types::{common::Round, sync_info::SyncInfo, vote::Vote};
 use aptos_crypto::HashValue;
 use aptos_logger::{prelude::*, Schema};
 use aptos_types::{
     ledger_info::LedgerInfoWithPartialSignatures, validator_verifier::ValidatorVerifier,
 };
-use consensus_types::timeout_2chain::TwoChainTimeoutWithPartialSignatures;
-use consensus_types::{common::Round, sync_info::SyncInfo, vote::Vote};
 use futures::future::AbortHandle;
 use serde::Serialize;
 use std::{fmt, sync::Arc, time::Duration};
diff --git a/consensus/src/liveness/round_state_test.rs b/consensus/src/liveness/round_state_test.rs
index 30de9f00658eb..114c52c83cfe5 100644
--- a/consensus/src/liveness/round_state_test.rs
+++ b/consensus/src/liveness/round_state_test.rs
@@ -8,19 +8,19 @@ use crate::{
     util::mock_time_service::SimulatedTimeService,
 };
 
-use aptos_crypto::HashValue;
-use aptos_types::aggregate_signature::AggregateSignature;
-use aptos_types::{
-    block_info::BlockInfo,
-    ledger_info::{LedgerInfo, LedgerInfoWithSignatures},
-};
-use consensus_types::{
+use aptos_consensus_types::{
     common::Round,
     quorum_cert::QuorumCert,
     sync_info::SyncInfo,
     timeout_2chain::{TwoChainTimeout, TwoChainTimeoutCertificate},
     vote_data::VoteData,
 };
+use aptos_crypto::HashValue;
+use aptos_types::aggregate_signature::AggregateSignature;
+use aptos_types::{
+    block_info::BlockInfo,
+    ledger_info::{LedgerInfo, LedgerInfoWithSignatures},
+};
 use futures::StreamExt;
 use std::{sync::Arc, time::Duration};
 
diff --git a/consensus/src/liveness/unequivocal_proposer_election.rs b/consensus/src/liveness/unequivocal_proposer_election.rs
index 5b3c753b31e2d..b8c2ed322e66a 100644
--- a/consensus/src/liveness/unequivocal_proposer_election.rs
+++ b/consensus/src/liveness/unequivocal_proposer_election.rs
@@ -3,13 +3,13 @@
 
 use std::cmp::Ordering;
 
-use aptos_crypto::HashValue;
-use aptos_infallible::Mutex;
-use aptos_logger::{error, SecurityEvent};
-use consensus_types::{
+use aptos_consensus_types::{
     block::Block,
     common::{Author, Round},
 };
+use aptos_crypto::HashValue;
+use aptos_infallible::Mutex;
+use aptos_logger::{error, SecurityEvent};
 
 use super::proposer_election::ProposerElection;
 
diff --git a/consensus/src/liveness/unequivocal_proposer_election_test.rs b/consensus/src/liveness/unequivocal_proposer_election_test.rs
index 4a7e94e6567be..8463968f66646 100644
--- a/consensus/src/liveness/unequivocal_proposer_election_test.rs
+++ b/consensus/src/liveness/unequivocal_proposer_election_test.rs
@@ -3,11 +3,11 @@
 
 use std::collections::HashMap;
 
-use aptos_types::validator_signer::ValidatorSigner;
-use consensus_types::{
+use aptos_consensus_types::{
     block::{block_test_utils::certificate_for_genesis, Block},
     common::{Author, Payload, Round},
 };
+use aptos_types::validator_signer::ValidatorSigner;
 
 use crate::liveness::unequivocal_proposer_election::UnequivocalProposerElection;
 
@@ -40,7 +40,7 @@ fn test_is_valid_proposal() {
     let quorum_cert = certificate_for_genesis();
 
     let good_proposal = Block::new_proposal(
-        Payload::empty(),
+        Payload::empty(false),
         1,
         1,
         quorum_cert.clone(),
@@ -49,7 +49,7 @@ fn test_is_valid_proposal() {
     )
     .unwrap();
     let bad_author_proposal = Block::new_proposal(
-        Payload::empty(),
+        Payload::empty(false),
         1,
         1,
         quorum_cert.clone(),
@@ -58,7 +58,7 @@ fn test_is_valid_proposal() {
     )
     .unwrap();
     let bad_duplicate_proposal = Block::new_proposal(
-        Payload::empty(),
+        Payload::empty(false),
         1,
         2,
         quorum_cert.clone(),
@@ -67,7 +67,7 @@ fn test_is_valid_proposal() {
     )
     .unwrap();
     let next_good_proposal = Block::new_proposal(
-        Payload::empty(),
+        Payload::empty(false),
         2,
         3,
         quorum_cert.clone(),
@@ -76,7 +76,7 @@ fn test_is_valid_proposal() {
     )
     .unwrap();
     let next_bad_duplicate_proposal = Block::new_proposal(
-        Payload::empty(),
+        Payload::empty(false),
         2,
         4,
         quorum_cert,
diff --git a/consensus/src/logging.rs b/consensus/src/logging.rs
index 3237fa91f47e3..f95a24c94e911 100644
--- a/consensus/src/logging.rs
+++ b/consensus/src/logging.rs
@@ -1,9 +1,9 @@
 // Copyright (c) Aptos
 // SPDX-License-Identifier: Apache-2.0
 
+use aptos_consensus_types::common::Author;
 use aptos_logger::Schema;
 use aptos_types::block_info::Round;
-use consensus_types::common::Author;
 use serde::Serialize;
 
 #[derive(Schema)]
diff --git a/consensus/src/metrics_safety_rules.rs b/consensus/src/metrics_safety_rules.rs
index e20b68b649b69..0247da654b535 100644
--- a/consensus/src/metrics_safety_rules.rs
+++ b/consensus/src/metrics_safety_rules.rs
@@ -2,18 +2,18 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::{monitor, persistent_liveness_storage::PersistentLivenessStorage};
+use aptos_consensus_types::{
+    block_data::BlockData,
+    timeout_2chain::{TwoChainTimeout, TwoChainTimeoutCertificate},
+    vote::Vote,
+    vote_proposal::VoteProposal,
+};
 use aptos_crypto::bls12381;
 use aptos_logger::prelude::info;
 use aptos_types::{
     epoch_change::EpochChangeProof,
     ledger_info::{LedgerInfo, LedgerInfoWithSignatures},
 };
-use consensus_types::{
-    block_data::BlockData,
-    timeout_2chain::{TwoChainTimeout, TwoChainTimeoutCertificate},
-    vote::Vote,
-    vote_proposal::VoteProposal,
-};
 use safety_rules::{ConsensusState, Error, TSafetyRules};
 use std::sync::Arc;
 
@@ -135,18 +135,18 @@ impl TSafetyRules for MetricsSafetyRules {
 #[cfg(test)]
 mod tests {
     use crate::{metrics_safety_rules::MetricsSafetyRules, test_utils::EmptyStorage};
+    use aptos_consensus_types::{
+        block_data::BlockData,
+        timeout_2chain::{TwoChainTimeout, TwoChainTimeoutCertificate},
+        vote::Vote,
+        vote_proposal::VoteProposal,
+    };
     use aptos_crypto::bls12381;
     use aptos_types::{
         epoch_change::EpochChangeProof,
         ledger_info::{LedgerInfo, LedgerInfoWithSignatures},
     };
     use claims::{assert_matches, assert_ok};
-    use consensus_types::{
-        block_data::BlockData,
-        timeout_2chain::{TwoChainTimeout, TwoChainTimeoutCertificate},
-        vote::Vote,
-        vote_proposal::VoteProposal,
-    };
     use safety_rules::{ConsensusState, Error, TSafetyRules};
 
     pub struct MockSafetyRules {
diff --git a/consensus/src/network.rs b/consensus/src/network.rs
index 2fff91d44f650..740bb011c1a12 100644
--- a/consensus/src/network.rs
+++ b/consensus/src/network.rs
@@ -9,14 +9,7 @@ use crate::{
     network_interface::{ConsensusMsg, ConsensusNetworkEvents, ConsensusNetworkSender},
 };
 use anyhow::{anyhow, ensure};
-use aptos_logger::prelude::*;
-use aptos_types::{
-    account_address::AccountAddress, epoch_change::EpochChangeProof,
-    ledger_info::LedgerInfoWithSignatures, validator_verifier::ValidatorVerifier,
-};
-use bytes::Bytes;
-use channel::{self, aptos_channel, message_queues::QueueStyle};
-use consensus_types::{
+use aptos_consensus_types::{
     block_retrieval::{BlockRetrievalRequest, BlockRetrievalResponse, MAX_BLOCKS_PER_REQUEST},
     common::Author,
     experimental::{commit_decision::CommitDecision, commit_vote::CommitVote},
@@ -24,6 +17,13 @@ use consensus_types::{
     sync_info::SyncInfo,
     vote_msg::VoteMsg,
 };
+use aptos_logger::prelude::*;
+use aptos_types::{
+    account_address::AccountAddress, epoch_change::EpochChangeProof,
+    ledger_info::LedgerInfoWithSignatures, validator_verifier::ValidatorVerifier,
+};
+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::{
diff --git a/consensus/src/network_interface.rs b/consensus/src/network_interface.rs
index f28fcfad2394b..333f03db0bbfb 100644
--- a/consensus/src/network_interface.rs
+++ b/consensus/src/network_interface.rs
@@ -6,11 +6,7 @@
 use crate::counters;
 use anyhow::anyhow;
 use aptos_config::network_id::{NetworkId, PeerNetworkId};
-use aptos_logger::prelude::*;
-use aptos_types::{epoch_change::EpochChangeProof, PeerId};
-use async_trait::async_trait;
-use channel::{aptos_channel, message_queues::QueueStyle};
-use consensus_types::{
+use aptos_consensus_types::{
     block_retrieval::{BlockRetrievalRequest, BlockRetrievalResponse},
     epoch_retrieval::EpochRetrievalRequest,
     experimental::{commit_decision::CommitDecision, commit_vote::CommitVote},
@@ -18,6 +14,10 @@ use consensus_types::{
     sync_info::SyncInfo,
     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::{
     application::storage::PeerMetadataStorage,
     constants::NETWORK_CHANNEL_SIZE,
diff --git a/consensus/src/network_tests.rs b/consensus/src/network_tests.rs
index 82dc96c14113f..bc2f884b736b1 100644
--- a/consensus/src/network_tests.rs
+++ b/consensus/src/network_tests.rs
@@ -7,10 +7,7 @@ use crate::{
     test_utils::{self, consensus_runtime, placeholder_ledger_info, timed_block_on},
 };
 use aptos_config::network_id::NetworkId;
-use aptos_infallible::{Mutex, RwLock};
-use aptos_types::{block_info::BlockInfo, PeerId};
-use channel::{self, aptos_channel, message_queues::QueueStyle};
-use consensus_types::{
+use aptos_consensus_types::{
     block::{block_test_utils::certificate_for_genesis, Block},
     common::Author,
     proposal_msg::ProposalMsg,
@@ -19,6 +16,9 @@ use consensus_types::{
     vote_data::VoteData,
     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::{
     application::storage::PeerMetadataStorage,
@@ -482,13 +482,13 @@ mod tests {
     use super::*;
     use crate::network::NetworkTask;
     use aptos_config::network_id::NetworkId;
-    use aptos_crypto::HashValue;
-    use aptos_types::validator_verifier::random_validator_verifier;
-    use bytes::Bytes;
-    use consensus_types::{
+    use aptos_consensus_types::{
         block_retrieval::{BlockRetrievalRequest, BlockRetrievalResponse, BlockRetrievalStatus},
         common::Payload,
     };
+    use aptos_crypto::HashValue;
+    use aptos_types::validator_verifier::random_validator_verifier;
+    use bytes::Bytes;
     use futures::{channel::oneshot, future};
     use network::{
         application::storage::PeerMetadataStorage, protocols::direct_send::Message,
@@ -618,7 +618,7 @@ mod tests {
         let previous_qc = certificate_for_genesis();
         let proposal = ProposalMsg::new(
             Block::new_proposal(
-                Payload::empty(),
+                Payload::empty(false),
                 1,
                 1,
                 previous_qc.clone(),
diff --git a/consensus/src/payload_client.rs b/consensus/src/payload_client.rs
new file mode 100644
index 0000000000000..a704bf478b822
--- /dev/null
+++ b/consensus/src/payload_client.rs
@@ -0,0 +1,120 @@
+// Copyright (c) Aptos
+// SPDX-License-Identifier: Apache-2.0
+
+use crate::{error::QuorumStoreError, monitor, state_replication::PayloadClient};
+use anyhow::Result;
+use aptos_consensus_types::common::Round;
+use aptos_consensus_types::{
+    common::{Payload, PayloadFilter},
+    request_response::{ConsensusResponse, PayloadRequest},
+};
+use aptos_logger::prelude::*;
+use fail::fail_point;
+use futures::{
+    channel::{mpsc, oneshot},
+    future::BoxFuture,
+};
+use std::time::Duration;
+use tokio::time::{sleep, timeout};
+
+const NO_TXN_DELAY: u64 = 30; // TODO: consider moving to a config
+
+/// Client that pulls blocks from Quorum Store
+#[derive(Clone)]
+pub struct QuorumStoreClient {
+    consensus_to_quorum_store_sender: mpsc::Sender,
+    poll_count: u64,
+    /// Timeout for consensus to pull transactions from quorum store and get a response (in milliseconds)
+    pull_timeout_ms: u64,
+}
+
+impl QuorumStoreClient {
+    pub fn new(
+        consensus_to_quorum_store_sender: mpsc::Sender,
+        poll_count: u64,
+        pull_timeout_ms: u64,
+    ) -> Self {
+        assert!(
+            poll_count > 0,
+            "poll_count = 0 won't pull any txns from quorum store"
+        );
+        Self {
+            consensus_to_quorum_store_sender,
+            poll_count,
+            pull_timeout_ms,
+        }
+    }
+
+    async fn pull_internal(
+        &self,
+        round: Round,
+        max_items: u64,
+        max_bytes: u64,
+        exclude_payloads: PayloadFilter,
+    ) -> Result {
+        let (callback, callback_rcv) = oneshot::channel();
+        let req = PayloadRequest::GetBlockRequest(
+            round,
+            max_items,
+            max_bytes,
+            exclude_payloads.clone(),
+            callback,
+        );
+        // send to shared mempool
+        self.consensus_to_quorum_store_sender
+            .clone()
+            .try_send(req)
+            .map_err(anyhow::Error::from)?;
+        // wait for response
+        match monitor!(
+            "pull_payload",
+            timeout(Duration::from_millis(self.pull_timeout_ms), callback_rcv).await
+        ) {
+            Err(_) => {
+                Err(anyhow::anyhow!("[consensus] did not receive GetBlockResponse on time").into())
+            }
+            Ok(resp) => match resp.map_err(anyhow::Error::from)?? {
+                ConsensusResponse::GetBlockResponse(payload) => Ok(payload),
+            },
+        }
+    }
+}
+
+#[async_trait::async_trait]
+impl PayloadClient for QuorumStoreClient {
+    async fn pull_payload(
+        &self,
+        round: Round,
+        max_items: u64,
+        max_bytes: u64,
+        exclude_payloads: PayloadFilter,
+        wait_callback: BoxFuture<'static, ()>,
+        pending_ordering: bool,
+    ) -> Result {
+        fail_point!("consensus::pull_payload", |_| {
+            Err(anyhow::anyhow!("Injected error in pull_payload").into())
+        });
+        let mut callback_wrapper = Some(wait_callback);
+        // keep polling QuorumStore until there's payloads available or there's still pending payloads
+        let mut count = self.poll_count;
+        let payload = loop {
+            count -= 1;
+            let payload = self
+                .pull_internal(round, max_items, max_bytes, exclude_payloads.clone())
+                .await?;
+            if payload.is_empty() && !pending_ordering && count > 0 {
+                if let Some(callback) = callback_wrapper.take() {
+                    callback.await;
+                }
+                sleep(Duration::from_millis(NO_TXN_DELAY)).await;
+                continue;
+            }
+            break payload;
+        };
+        debug!(
+            poll_count = self.poll_count - count,
+            "Pull payloads from QuorumStore"
+        );
+        Ok(payload)
+    }
+}
diff --git a/consensus/src/payload_manager.rs b/consensus/src/payload_manager.rs
index 9a77181acd574..9e4b7268acdb2 100644
--- a/consensus/src/payload_manager.rs
+++ b/consensus/src/payload_manager.rs
@@ -1,119 +1,191 @@
 // Copyright (c) Aptos
 // SPDX-License-Identifier: Apache-2.0
 
-use crate::{error::QuorumStoreError, monitor, state_replication::PayloadManager};
-use anyhow::Result;
-use aptos_logger::prelude::*;
-use consensus_types::{
-    common::{Payload, PayloadFilter},
-    request_response::{ConsensusRequest, ConsensusResponse},
+use crate::quorum_store::batch_reader::BatchReader;
+use aptos_consensus_types::{
+    block::Block,
+    common::{DataStatus, Payload},
+    proof_of_store::{LogicalTime, ProofOfStore},
+    request_response::PayloadRequest,
 };
-use fail::fail_point;
-use futures::{
-    channel::{mpsc, oneshot},
-    future::BoxFuture,
-};
-use std::time::Duration;
-use tokio::time::{sleep, timeout};
-
-const NO_TXN_DELAY: u64 = 30;
+use aptos_crypto::HashValue;
+use aptos_executor_types::Error::DataNotFound;
+use aptos_executor_types::*;
+use aptos_infallible::Mutex;
+use aptos_logger::{debug, warn};
+use aptos_types::transaction::SignedTransaction;
+use futures::channel::mpsc::Sender;
+use futures::SinkExt;
+use tokio::sync::oneshot;
 
-/// Client that pulls blocks from Quorum Store
-#[derive(Clone)]
-pub struct QuorumStoreClient {
-    consensus_to_quorum_store_sender: mpsc::Sender,
-    poll_count: u64,
-    /// Timeout for consensus to pull transactions from quorum store and get a response (in milliseconds)
-    pull_timeout_ms: u64,
+/// Responsible to extract the transactions out of the payload and notify QuorumStore about commits.
+/// If QuorumStore is enabled, has to ask BatchReader for the transaction behind the proofs of availability in the payload.
+pub enum PayloadManager {
+    DirectMempool,
+    InQuorumStore(BatchReader, Mutex>),
 }
 
-impl QuorumStoreClient {
-    pub fn new(
-        consensus_to_quorum_store_sender: mpsc::Sender,
-        poll_count: u64,
-        pull_timeout_ms: u64,
-    ) -> Self {
-        assert!(
-            poll_count > 0,
-            "poll_count = 0 won't pull any txns from quorum store"
-        );
-        Self {
-            consensus_to_quorum_store_sender,
-            poll_count,
-            pull_timeout_ms,
+impl PayloadManager {
+    async fn request_transactions(
+        proofs: Vec,
+        logical_time: LogicalTime,
+        batch_reader: &BatchReader,
+    ) -> Vec<(
+        HashValue,
+        oneshot::Receiver, aptos_executor_types::Error>>,
+    )> {
+        let mut receivers = Vec::new();
+        for pos in proofs {
+            debug!(
+                "QSE: requesting pos {:?}, digest {}, time = {:?}",
+                pos,
+                pos.digest(),
+                logical_time
+            );
+            if logical_time <= pos.expiration() {
+                receivers.push((*pos.digest(), batch_reader.get_batch(pos).await));
+            } else {
+                debug!("QS: skipped expired pos");
+            }
         }
+        receivers
     }
 
-    async fn pull_internal(
-        &self,
-        max_items: u64,
-        max_bytes: u64,
-        exclude_payloads: PayloadFilter,
-    ) -> Result {
-        let (callback, callback_rcv) = oneshot::channel();
-        let req = ConsensusRequest::GetBlockRequest(
-            max_items,
-            max_bytes,
-            exclude_payloads.clone(),
-            callback,
-        );
-        // send to shared mempool
-        self.consensus_to_quorum_store_sender
-            .clone()
-            .try_send(req)
-            .map_err(anyhow::Error::from)?;
-        // wait for response
-        match monitor!(
-            "pull_payload",
-            timeout(Duration::from_millis(self.pull_timeout_ms), callback_rcv).await
-        ) {
-            Err(_) => {
-                Err(anyhow::anyhow!("[consensus] did not receive GetBlockResponse on time").into())
+    ///Pass commit information to BatchReader and QuorumStore wrapper for their internal cleanups.
+    pub async fn notify_commit(&self, logical_time: LogicalTime, payloads: Vec) {
+        match self {
+            PayloadManager::DirectMempool => {}
+            PayloadManager::InQuorumStore(batch_reader, quorum_store_wrapper_tx) => {
+                batch_reader.update_certified_round(logical_time).await;
+
+                let digests: Vec = payloads
+                    .into_iter()
+                    .flat_map(|payload| match payload {
+                        Payload::DirectMempool(_) => {
+                            unreachable!("InQuorumStore should be used");
+                        }
+                        Payload::InQuorumStore(proof_with_status) => proof_with_status.proofs,
+                    })
+                    .map(|proof| *proof.digest())
+                    .collect();
+
+                let _ = quorum_store_wrapper_tx
+                    .lock()
+                    .send(PayloadRequest::CleanRequest(logical_time, digests));
             }
-            Ok(resp) => match resp.map_err(anyhow::Error::from)?? {
-                ConsensusResponse::GetBlockResponse(payload) => Ok(payload),
-                _ => Err(
-                    anyhow::anyhow!("[consensus] did not receive expected GetBlockResponse").into(),
-                ),
+        }
+    }
+
+    /// Called from consensus to pre-fetch the transaction behind the batches in the block.
+    pub async fn prefetch_payload_data(&self, block: &Block) {
+        let payload = match block.payload() {
+            Some(p) => p,
+            None => return,
+        };
+        match self {
+            PayloadManager::DirectMempool => {}
+            PayloadManager::InQuorumStore(batch_reader, _) => match payload {
+                Payload::InQuorumStore(proof_with_status) => {
+                    if proof_with_status.status.lock().is_none() {
+                        let receivers = PayloadManager::request_transactions(
+                            proof_with_status.proofs.clone(),
+                            LogicalTime::new(block.epoch(), block.round()),
+                            batch_reader,
+                        )
+                        .await;
+                        proof_with_status
+                            .status
+                            .lock()
+                            .replace(DataStatus::Requested(receivers));
+                    }
+                }
+                Payload::DirectMempool(_) => {
+                    unreachable!()
+                }
             },
         }
     }
-}
 
-#[async_trait::async_trait]
-impl PayloadManager for QuorumStoreClient {
-    async fn pull_payload(
-        &self,
-        max_items: u64,
-        max_bytes: u64,
-        exclude_payloads: PayloadFilter,
-        wait_callback: BoxFuture<'static, ()>,
-        pending_ordering: bool,
-    ) -> Result {
-        fail_point!("consensus::pull_payload", |_| {
-            Err(anyhow::anyhow!("Injected error in pull_payload").into())
-        });
-        let mut callback_wrapper = Some(wait_callback);
-        // keep polling QuorumStore until there's payloads available or there's still pending payloads
-        let mut count = self.poll_count;
-        let payload = loop {
-            count -= 1;
-            let payload = self
-                .pull_internal(max_items, max_bytes, exclude_payloads.clone())
-                .await?;
-            if payload.is_empty() && !pending_ordering && count > 0 {
-                if let Some(callback) = callback_wrapper.take() {
-                    callback.await;
+    /// Extract transaction from a given block
+    /// Assumes it is never called for the same block concurrently. Otherwise status can be None.
+    pub async fn get_transactions(&self, block: &Block) -> Result, Error> {
+        let payload = match block.payload() {
+            Some(p) => p,
+            None => return Ok(Vec::new()),
+        };
+
+        match (self, payload) {
+            (PayloadManager::DirectMempool, Payload::DirectMempool(txns)) => Ok(txns.clone()),
+            (
+                PayloadManager::InQuorumStore(batch_reader, _),
+                Payload::InQuorumStore(proof_with_data),
+            ) => {
+                let status = proof_with_data.status.lock().take();
+                match status.expect("Should have been updated before.") {
+                    DataStatus::Cached(data) => {
+                        proof_with_data
+                            .status
+                            .lock()
+                            .replace(DataStatus::Cached(data.clone()));
+                        Ok(data)
+                    }
+                    DataStatus::Requested(receivers) => {
+                        let mut vec_ret = Vec::new();
+                        debug!("QSE: waiting for data on {} receivers", receivers.len());
+                        for (digest, rx) in receivers {
+                            match rx.await {
+                                Err(e) => {
+                                    // We probably advanced epoch already.
+                                    warn!("Oneshot channel to get a batch was dropped with error {:?}", e);
+                                    let new_receivers = PayloadManager::request_transactions(
+                                        proof_with_data.proofs.clone(),
+                                        LogicalTime::new(block.epoch(), block.round()),
+                                        batch_reader,
+                                    )
+                                    .await;
+                                    // Could not get all data so requested again
+                                    proof_with_data
+                                        .status
+                                        .lock()
+                                        .replace(DataStatus::Requested(new_receivers));
+                                    return Err(DataNotFound(digest));
+                                }
+                                Ok(Ok(data)) => {
+                                    vec_ret.push(data);
+                                }
+                                Ok(Err(e)) => {
+                                    let new_receivers = PayloadManager::request_transactions(
+                                        proof_with_data.proofs.clone(),
+                                        LogicalTime::new(block.epoch(), block.round()),
+                                        batch_reader,
+                                    )
+                                    .await;
+                                    // Could not get all data so requested again
+                                    proof_with_data
+                                        .status
+                                        .lock()
+                                        .replace(DataStatus::Requested(new_receivers));
+                                    return Err(e);
+                                }
+                            }
+                        }
+                        let ret: Vec = vec_ret.into_iter().flatten().collect();
+                        // execution asks for the data twice, so data is cached here for the second time.
+                        proof_with_data
+                            .status
+                            .lock()
+                            .replace(DataStatus::Cached(ret.clone()));
+                        Ok(ret)
+                    }
                 }
-                sleep(Duration::from_millis(NO_TXN_DELAY)).await;
-                continue;
             }
-            break payload;
-        };
-        debug!(
-            poll_count = self.poll_count - count,
-            "Pull payloads from QuorumStore"
-        );
-        Ok(payload)
+            (_, _) => unreachable!(
+                "Wrong payload {} epoch {}, round {}, id {}",
+                payload,
+                block.block_data().epoch(),
+                block.block_data().round(),
+                block.id()
+            ),
+        }
     }
 }
diff --git a/consensus/src/pending_votes.rs b/consensus/src/pending_votes.rs
index 88818520067da..ab59b8e7822ca 100644
--- a/consensus/src/pending_votes.rs
+++ b/consensus/src/pending_votes.rs
@@ -7,6 +7,10 @@
 //! when enough votes (or timeout votes) have been observed.
 //! Votes are automatically dropped when the structure goes out of scope.
 
+use aptos_consensus_types::timeout_2chain::TwoChainTimeoutWithPartialSignatures;
+use aptos_consensus_types::{
+    common::Author, quorum_cert::QuorumCert, timeout_2chain::TwoChainTimeoutCertificate, vote::Vote,
+};
 use aptos_crypto::{hash::CryptoHash, HashValue};
 use aptos_logger::prelude::*;
 use aptos_types::{
@@ -14,10 +18,6 @@ use aptos_types::{
     ledger_info::LedgerInfoWithPartialSignatures,
     validator_verifier::{ValidatorVerifier, VerifyError},
 };
-use consensus_types::timeout_2chain::TwoChainTimeoutWithPartialSignatures;
-use consensus_types::{
-    common::Author, quorum_cert::QuorumCert, timeout_2chain::TwoChainTimeoutCertificate, vote::Vote,
-};
 use std::{
     collections::{BTreeMap, HashMap},
     fmt,
@@ -269,14 +269,14 @@ impl fmt::Display for PendingVotes {
 #[cfg(test)]
 mod tests {
     use super::{PendingVotes, VoteReceptionResult};
+    use aptos_consensus_types::{
+        block::block_test_utils::certificate_for_genesis, vote::Vote, vote_data::VoteData,
+    };
     use aptos_crypto::HashValue;
     use aptos_types::{
         block_info::BlockInfo, ledger_info::LedgerInfo,
         validator_verifier::random_validator_verifier,
     };
-    use consensus_types::{
-        block::block_test_utils::certificate_for_genesis, vote::Vote, vote_data::VoteData,
-    };
     use itertools::Itertools;
 
     /// Creates a random ledger info for epoch 1 and round 1.
diff --git a/consensus/src/persistent_liveness_storage.rs b/consensus/src/persistent_liveness_storage.rs
index 487123ac612e4..6559b3a0b62f2 100644
--- a/consensus/src/persistent_liveness_storage.rs
+++ b/consensus/src/persistent_liveness_storage.rs
@@ -4,15 +4,15 @@
 use crate::{consensusdb::ConsensusDB, epoch_manager::LivenessStorageData, error::DbError};
 use anyhow::{format_err, Context, Result};
 use aptos_config::config::NodeConfig;
+use aptos_consensus_types::{
+    block::Block, quorum_cert::QuorumCert, timeout_2chain::TwoChainTimeoutCertificate, vote::Vote,
+};
 use aptos_crypto::HashValue;
 use aptos_logger::prelude::*;
 use aptos_types::{
     block_info::Round, epoch_change::EpochChangeProof, ledger_info::LedgerInfoWithSignatures,
     proof::TransactionAccumulatorSummary, transaction::Version,
 };
-use consensus_types::{
-    block::Block, quorum_cert::QuorumCert, timeout_2chain::TwoChainTimeoutCertificate, vote::Vote,
-};
 use std::{cmp::max, collections::HashSet, sync::Arc};
 use storage_interface::DbReader;
 
diff --git a/consensus/src/quorum_store/batch_reader.rs b/consensus/src/quorum_store/batch_reader.rs
new file mode 100644
index 0000000000000..a4e734db30631
--- /dev/null
+++ b/consensus/src/quorum_store/batch_reader.rs
@@ -0,0 +1,27 @@
+// Copyright (c) Aptos
+// SPDX-License-Identifier: Apache-2.0
+
+use aptos_consensus_types::proof_of_store::{LogicalTime, ProofOfStore};
+use aptos_executor_types::Error;
+use aptos_types::transaction::SignedTransaction;
+use tokio::sync::oneshot;
+
+pub struct BatchReader {}
+
+impl BatchReader {
+    pub async fn get_batch(
+        &self,
+        _proof: ProofOfStore,
+    ) -> oneshot::Receiver, Error>> {
+        let (_tx, rx) = oneshot::channel();
+        // TODO: verify expiration
+
+        // TODO: coming soon
+
+        rx
+    }
+
+    pub async fn update_certified_round(&self, _certified_time: LogicalTime) {
+        // TODO: coming soon
+    }
+}
diff --git a/consensus/src/quorum_store/direct_mempool_quorum_store.rs b/consensus/src/quorum_store/direct_mempool_quorum_store.rs
index 52bd19a0e3bb0..713a24001e1c6 100644
--- a/consensus/src/quorum_store/direct_mempool_quorum_store.rs
+++ b/consensus/src/quorum_store/direct_mempool_quorum_store.rs
@@ -3,13 +3,13 @@
 
 use crate::{monitor, quorum_store::counters};
 use anyhow::Result;
+use aptos_consensus_types::{
+    common::{Payload, PayloadFilter, TransactionSummary},
+    request_response::{ConsensusResponse, PayloadRequest},
+};
 use aptos_logger::prelude::*;
 use aptos_mempool::{QuorumStoreRequest, QuorumStoreResponse};
 use aptos_types::transaction::SignedTransaction;
-use consensus_types::{
-    common::{Payload, PayloadFilter, TransactionSummary},
-    request_response::{ConsensusRequest, ConsensusResponse},
-};
 use futures::{
     channel::{
         mpsc::{Receiver, Sender},
@@ -21,14 +21,14 @@ use std::time::{Duration, Instant};
 use tokio::time::timeout;
 
 pub struct DirectMempoolQuorumStore {
-    consensus_receiver: Receiver,
+    consensus_receiver: Receiver,
     mempool_sender: Sender,
     mempool_txn_pull_timeout_ms: u64,
 }
 
 impl DirectMempoolQuorumStore {
     pub fn new(
-        consensus_receiver: Receiver,
+        consensus_receiver: Receiver,
         mempool_sender: Sender,
         mempool_txn_pull_timeout_ms: u64,
     ) -> Self {
@@ -80,16 +80,20 @@ impl DirectMempoolQuorumStore {
         callback: oneshot::Sender>,
     ) {
         let get_batch_start_time = Instant::now();
-        let (txns, result) = match payload_filter {
-            PayloadFilter::DirectMempool(exclude_txns) => {
-                match self.pull_internal(max_txns, max_bytes, exclude_txns).await {
-                    Err(e) => {
-                        error!("GetBatch failed {:?}", e);
-                        (vec![], counters::REQUEST_FAIL_LABEL)
-                    }
-                    Ok(txns) => (txns, counters::REQUEST_SUCCESS_LABEL),
-                }
+        let exclude_txns = match payload_filter {
+            PayloadFilter::DirectMempool(exclude_txns) => exclude_txns,
+            PayloadFilter::InQuorumStore(_) => {
+                unreachable!("Unknown payload_filter: {}", payload_filter)
+            }
+            PayloadFilter::Empty => Vec::new(),
+        };
+
+        let (txns, result) = match self.pull_internal(max_txns, max_bytes, exclude_txns).await {
+            Err(_) => {
+                error!("GetBatch failed");
+                (vec![], counters::REQUEST_FAIL_LABEL)
             }
+            Ok(txns) => (txns, counters::REQUEST_SUCCESS_LABEL),
         };
         counters::quorum_store_service_latency(
             counters::GET_BATCH_LABEL,
@@ -113,24 +117,20 @@ impl DirectMempoolQuorumStore {
         );
     }
 
-    async fn handle_clean_request(&self, callback: oneshot::Sender>) {
-        match callback.send(Ok(ConsensusResponse::CleanResponse())) {
-            Err(_) => {
-                error!("Callback failed");
-                counters::CALLBACK_FAIL_LABEL
-            }
-            Ok(_) => counters::CALLBACK_SUCCESS_LABEL,
-        };
-    }
-
-    async fn handle_consensus_request(&self, req: ConsensusRequest) {
+    async fn handle_consensus_request(&self, req: PayloadRequest) {
         match req {
-            ConsensusRequest::GetBlockRequest(max_txns, max_bytes, payload_filter, callback) => {
+            PayloadRequest::GetBlockRequest(
+                _round,
+                max_txns,
+                max_bytes,
+                payload_filter,
+                callback,
+            ) => {
                 self.handle_block_request(max_txns, max_bytes, payload_filter, callback)
                     .await;
             }
-            ConsensusRequest::CleanRequest(_, _, callback) => {
-                self.handle_clean_request(callback).await;
+            PayloadRequest::CleanRequest(..) => {
+                unreachable!()
             }
         }
     }
diff --git a/consensus/src/quorum_store/mod.rs b/consensus/src/quorum_store/mod.rs
index c16fa8047af21..66aac53134730 100644
--- a/consensus/src/quorum_store/mod.rs
+++ b/consensus/src/quorum_store/mod.rs
@@ -4,6 +4,7 @@
 /// Equivalent to directly fetching blocks from mempool without a quorum store.
 pub mod direct_mempool_quorum_store;
 
+pub(crate) mod batch_reader;
 mod counters;
 #[cfg(test)]
 mod tests;
diff --git a/consensus/src/quorum_store/tests/direct_mempool_quorum_store_test.rs b/consensus/src/quorum_store/tests/direct_mempool_quorum_store_test.rs
index 9c1b2e449bba1..b19a2ef051d4a 100644
--- a/consensus/src/quorum_store/tests/direct_mempool_quorum_store_test.rs
+++ b/consensus/src/quorum_store/tests/direct_mempool_quorum_store_test.rs
@@ -2,11 +2,11 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::quorum_store::direct_mempool_quorum_store::DirectMempoolQuorumStore;
-use aptos_mempool::{QuorumStoreRequest, QuorumStoreResponse};
-use consensus_types::{
-    common::{Payload, PayloadFilter},
-    request_response::{ConsensusRequest, ConsensusResponse},
+use aptos_consensus_types::{
+    common::PayloadFilter,
+    request_response::{ConsensusResponse, PayloadRequest},
 };
+use aptos_mempool::{QuorumStoreRequest, QuorumStoreResponse};
 use futures::{
     channel::{mpsc, oneshot},
     StreamExt,
@@ -29,7 +29,8 @@ async fn test_block_request_no_txns() {
 
     let (consensus_callback, consensus_callback_rcv) = oneshot::channel();
     consensus_to_quorum_store_sender
-        .try_send(ConsensusRequest::GetBlockRequest(
+        .try_send(PayloadRequest::GetBlockRequest(
+            1,
             100,
             1000,
             PayloadFilter::DirectMempool(vec![]),
@@ -64,12 +65,6 @@ async fn test_block_request_no_txns() {
     {
         ConsensusResponse::GetBlockResponse(payload) => {
             assert!(payload.is_empty());
-            match payload {
-                Payload::DirectMempool(txns) => assert!(txns.is_empty()),
-            }
-        }
-        _ => {
-            panic!("Unexpected variant")
         }
     }
 
diff --git a/consensus/src/recovery_manager.rs b/consensus/src/recovery_manager.rs
index f96b41c7a1906..733d54a91891f 100644
--- a/consensus/src/recovery_manager.rs
+++ b/consensus/src/recovery_manager.rs
@@ -12,12 +12,12 @@ use crate::{
     state_replication::StateComputer,
 };
 use anyhow::{anyhow, ensure, Context, Result};
+use aptos_consensus_types::{
+    common::Author, proposal_msg::ProposalMsg, sync_info::SyncInfo, vote_msg::VoteMsg,
+};
 use aptos_logger::prelude::*;
 use aptos_types::{block_info::Round, epoch_state::EpochState};
 use channel::aptos_channel;
-use consensus_types::{
-    common::Author, proposal_msg::ProposalMsg, sync_info::SyncInfo, vote_msg::VoteMsg,
-};
 use futures::{FutureExt, StreamExt};
 use futures_channel::oneshot;
 use std::{mem::Discriminant, process, sync::Arc};
diff --git a/consensus/src/round_manager.rs b/consensus/src/round_manager.rs
index 0d39cb9aecd34..95c2066dc57c8 100644
--- a/consensus/src/round_manager.rs
+++ b/consensus/src/round_manager.rs
@@ -24,14 +24,7 @@ use crate::{
 };
 use anyhow::{bail, ensure, Context, Result};
 use aptos_config::config::ConsensusConfig;
-use aptos_infallible::{checked, Mutex};
-use aptos_logger::prelude::*;
-use aptos_types::{
-    epoch_state::EpochState, on_chain_config::OnChainConsensusConfig,
-    validator_verifier::ValidatorVerifier,
-};
-use channel::aptos_channel;
-use consensus_types::{
+use aptos_consensus_types::{
     block::Block,
     common::{Author, Round},
     experimental::{commit_decision::CommitDecision, commit_vote::CommitVote},
@@ -42,6 +35,13 @@ use consensus_types::{
     vote::Vote,
     vote_msg::VoteMsg,
 };
+use aptos_infallible::{checked, Mutex};
+use aptos_logger::prelude::*;
+use aptos_types::{
+    epoch_state::EpochState, on_chain_config::OnChainConsensusConfig,
+    validator_verifier::ValidatorVerifier,
+};
+use channel::aptos_channel;
 use fail::fail_point;
 use futures::{channel::oneshot, FutureExt, StreamExt};
 #[cfg(test)]
@@ -67,10 +67,14 @@ pub enum UnverifiedEvent {
 pub const BACK_PRESSURE_POLLING_INTERVAL_MS: u64 = 10;
 
 impl UnverifiedEvent {
-    pub fn verify(self, validator: &ValidatorVerifier) -> Result {
+    pub fn verify(
+        self,
+        validator: &ValidatorVerifier,
+        quorum_store_enabled: bool,
+    ) -> Result {
         Ok(match self {
             UnverifiedEvent::ProposalMsg(p) => {
-                p.verify(validator)?;
+                p.verify(validator, quorum_store_enabled)?;
                 VerifiedEvent::ProposalMsg(p)
             }
             UnverifiedEvent::VoteMsg(v) => {
diff --git a/consensus/src/round_manager_fuzzing.rs b/consensus/src/round_manager_fuzzing.rs
index d4c6785c24db9..b4ff60d8231fc 100644
--- a/consensus/src/round_manager_fuzzing.rs
+++ b/consensus/src/round_manager_fuzzing.rs
@@ -11,12 +11,14 @@ use crate::{
     metrics_safety_rules::MetricsSafetyRules,
     network::NetworkSender,
     network_interface::ConsensusNetworkSender,
+    payload_manager::PayloadManager,
     persistent_liveness_storage::{PersistentLivenessStorage, RecoveryData},
     round_manager::RoundManager,
     test_utils::{EmptyStateComputer, MockPayloadManager, MockStorage},
     util::{mock_time_service::SimulatedTimeService, time_service::TimeService},
 };
 use aptos_config::config::ConsensusConfig;
+use aptos_consensus_types::proposal_msg::ProposalMsg;
 use aptos_infallible::Mutex;
 use aptos_types::{
     aggregate_signature::AggregateSignature,
@@ -29,7 +31,6 @@ use aptos_types::{
     validator_verifier::ValidatorVerifier,
 };
 use channel::{self, aptos_channel, message_queues::QueueStyle};
-use consensus_types::proposal_msg::ProposalMsg;
 use futures::{channel::mpsc, executor::block_on};
 use network::{
     peer_manager::{ConnectionRequestSender, PeerManagerRequestSender},
@@ -76,6 +77,7 @@ fn build_empty_store(
         10, // max pruned blocks in mem
         Arc::new(SimulatedTimeService::new()),
         10,
+        Arc::from(PayloadManager::DirectMempool),
     ))
 }
 
@@ -152,6 +154,7 @@ fn create_node_for_fuzzing() -> RoundManager {
         1024,
         10,
         ChainHealthBackoffConfig::new_no_backoff(),
+        false,
     );
 
     //
diff --git a/consensus/src/round_manager_test.rs b/consensus/src/round_manager_test.rs
index 5676d4e4a1954..079353377426e 100644
--- a/consensus/src/round_manager_test.rs
+++ b/consensus/src/round_manager_test.rs
@@ -14,6 +14,7 @@ use crate::{
     network::{IncomingBlockRetrievalRequest, NetworkSender},
     network_interface::{ConsensusMsg, ConsensusNetworkEvents, ConsensusNetworkSender},
     network_tests::{NetworkPlayground, TwinId},
+    payload_manager::PayloadManager,
     persistent_liveness_storage::RecoveryData,
     round_manager::RoundManager,
     test_utils::{
@@ -23,6 +24,19 @@ use crate::{
     util::time_service::{ClockTimeService, TimeService},
 };
 use aptos_config::{config::ConsensusConfig, network_id::NetworkId};
+use aptos_consensus_types::{
+    block::{
+        block_test_utils::{certificate_for_genesis, gen_test_certificate},
+        Block,
+    },
+    block_retrieval::{BlockRetrievalRequest, BlockRetrievalStatus},
+    common::{Author, Payload, Round},
+    experimental::commit_decision::CommitDecision,
+    proposal_msg::ProposalMsg,
+    sync_info::SyncInfo,
+    timeout_2chain::{TwoChainTimeout, TwoChainTimeoutWithPartialSignatures},
+    vote_msg::VoteMsg,
+};
 use aptos_crypto::HashValue;
 use aptos_infallible::Mutex;
 use aptos_logger::prelude::info;
@@ -37,19 +51,6 @@ use aptos_types::{
     waypoint::Waypoint,
 };
 use channel::{self, aptos_channel, message_queues::QueueStyle};
-use consensus_types::{
-    block::{
-        block_test_utils::{certificate_for_genesis, gen_test_certificate},
-        Block,
-    },
-    block_retrieval::{BlockRetrievalRequest, BlockRetrievalStatus},
-    common::{Author, Payload, Round},
-    experimental::commit_decision::CommitDecision,
-    proposal_msg::ProposalMsg,
-    sync_info::SyncInfo,
-    timeout_2chain::{TwoChainTimeout, TwoChainTimeoutWithPartialSignatures},
-    vote_msg::VoteMsg,
-};
 use futures::{
     channel::{mpsc, oneshot},
     executor::block_on,
@@ -216,6 +217,7 @@ impl NodeSetup {
             10, // max pruned blocks in mem
             time_service.clone(),
             10,
+            Arc::from(PayloadManager::DirectMempool),
         ));
 
         let proposer_election = Self::create_proposer_election(proposers.clone());
@@ -228,6 +230,7 @@ impl NodeSetup {
             1000,
             10,
             ChainHealthBackoffConfig::new_no_backoff(),
+            false,
         );
 
         let round_state = Self::create_round_state(time_service);
@@ -609,7 +612,7 @@ fn vote_on_successful_proposal() {
         node.next_proposal().await;
 
         let proposal = Block::new_proposal(
-            Payload::empty(),
+            Payload::empty(false),
             1,
             1,
             genesis_qc.clone(),
@@ -650,7 +653,7 @@ fn delay_proposal_processing_in_sync_only() {
             .block_store
             .set_back_pressure_for_test(true);
         let proposal = Block::new_proposal(
-            Payload::empty(),
+            Payload::empty(false),
             1,
             1,
             genesis_qc.clone(),
@@ -702,7 +705,7 @@ fn no_vote_on_old_proposal() {
     let node = &mut nodes[0];
     let genesis_qc = certificate_for_genesis();
     let new_block = Block::new_proposal(
-        Payload::empty(),
+        Payload::empty(false),
         1,
         1,
         genesis_qc.clone(),
@@ -711,8 +714,15 @@ fn no_vote_on_old_proposal() {
     )
     .unwrap();
     let new_block_id = new_block.id();
-    let old_block =
-        Block::new_proposal(Payload::empty(), 1, 2, genesis_qc, &node.signer, Vec::new()).unwrap();
+    let old_block = Block::new_proposal(
+        Payload::empty(false),
+        1,
+        2,
+        genesis_qc,
+        &node.signer,
+        Vec::new(),
+    )
+    .unwrap();
     timed_block_on(&runtime, async {
         // clear the message queue
         node.next_proposal().await;
@@ -745,7 +755,7 @@ fn no_vote_on_mismatch_round() {
         .unwrap();
     let genesis_qc = certificate_for_genesis();
     let correct_block = Block::new_proposal(
-        Payload::empty(),
+        Payload::empty(false),
         1,
         1,
         genesis_qc.clone(),
@@ -754,7 +764,7 @@ fn no_vote_on_mismatch_round() {
     )
     .unwrap();
     let block_skip_round = Block::new_proposal(
-        Payload::empty(),
+        Payload::empty(false),
         2,
         2,
         genesis_qc.clone(),
@@ -849,7 +859,7 @@ fn no_vote_on_invalid_proposer() {
     let mut node = nodes.pop().unwrap();
     let genesis_qc = certificate_for_genesis();
     let correct_block = Block::new_proposal(
-        Payload::empty(),
+        Payload::empty(false),
         1,
         1,
         genesis_qc.clone(),
@@ -858,7 +868,7 @@ fn no_vote_on_invalid_proposer() {
     )
     .unwrap();
     let block_incorrect_proposer = Block::new_proposal(
-        Payload::empty(),
+        Payload::empty(false),
         1,
         1,
         genesis_qc.clone(),
@@ -900,7 +910,7 @@ fn new_round_on_timeout_certificate() {
         .unwrap();
     let genesis_qc = certificate_for_genesis();
     let correct_block = Block::new_proposal(
-        Payload::empty(),
+        Payload::empty(false),
         1,
         1,
         genesis_qc.clone(),
@@ -909,7 +919,7 @@ fn new_round_on_timeout_certificate() {
     )
     .unwrap();
     let block_skip_round = Block::new_proposal(
-        Payload::empty(),
+        Payload::empty(false),
         2,
         2,
         genesis_qc.clone(),
@@ -972,7 +982,7 @@ fn reject_invalid_failed_authors() {
 
     let create_proposal = |round: Round, failed_authors: Vec<(Round, Author)>| {
         let block = Block::new_proposal(
-            Payload::empty(),
+            Payload::empty(false),
             round,
             2,
             genesis_qc.clone(),
@@ -1047,7 +1057,7 @@ fn response_on_block_retrieval() {
 
     let genesis_qc = certificate_for_genesis();
     let block = Block::new_proposal(
-        Payload::empty(),
+        Payload::empty(false),
         1,
         1,
         genesis_qc.clone(),
@@ -1159,7 +1169,7 @@ fn recover_on_restart() {
             genesis_qc.clone(),
             i,
             i,
-            Payload::empty(),
+            Payload::empty(false),
             (std::cmp::max(1, i.saturating_sub(10))..i)
                 .map(|i| (i, inserter.signer().author()))
                 .collect(),
diff --git a/consensus/src/state_computer.rs b/consensus/src/state_computer.rs
index 28e569f418ea8..2a5e2d0c93d93 100644
--- a/consensus/src/state_computer.rs
+++ b/consensus/src/state_computer.rs
@@ -2,27 +2,33 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::monitor;
+use crate::payload_manager::PayloadManager;
 use crate::{
     block_storage::tracing::{observe_block, BlockStage},
-    commit_notifier::CommitNotifier,
     counters,
     error::StateSyncError,
     state_replication::{StateComputer, StateComputerCommitCallBackType},
     txn_notifier::TxnNotifier,
 };
 use anyhow::Result;
+use aptos_consensus_notifications::ConsensusNotificationSender;
+use aptos_consensus_types::{
+    block::Block,
+    common::{Payload, Round},
+    executed_block::ExecutedBlock,
+    proof_of_store::LogicalTime,
+};
 use aptos_crypto::HashValue;
+use aptos_executor_types::{BlockExecutorTrait, Error as ExecutionError, StateComputeResult};
 use aptos_infallible::Mutex;
 use aptos_logger::prelude::*;
 use aptos_types::{
     account_address::AccountAddress, contract_event::ContractEvent, epoch_state::EpochState,
     ledger_info::LedgerInfoWithSignatures, transaction::Transaction,
 };
-use consensus_notifications::ConsensusNotificationSender;
-use consensus_types::{block::Block, common::Round, executed_block::ExecutedBlock};
-use executor_types::{BlockExecutorTrait, Error as ExecutionError, StateComputeResult};
 use fail::fail_point;
 use futures::{SinkExt, StreamExt};
+use std::cmp::max;
 use std::{boxed::Box, sync::Arc};
 use tokio::sync::Mutex as AsyncMutex;
 
@@ -32,7 +38,7 @@ type NotificationType = (
     Vec,
 );
 
-type CommitType = (u64, Round);
+type CommitType = (u64, Round, Vec);
 
 /// Basic communication with the Execution module;
 /// implements StateComputer traits.
@@ -41,9 +47,9 @@ pub struct ExecutionProxy {
     txn_notifier: Arc,
     state_sync_notifier: Arc,
     async_state_sync_notifier: channel::Sender,
-    async_commit_notifier: channel::Sender,
     validators: Mutex>,
     write_mutex: AsyncMutex<()>,
+    payload_manager: Mutex>>,
 }
 
 impl ExecutionProxy {
@@ -51,7 +57,6 @@ impl ExecutionProxy {
         executor: Arc,
         txn_notifier: Arc,
         state_sync_notifier: Arc,
-        commit_notifier: Arc,
         handle: &tokio::runtime::Handle,
     ) -> Self {
         let (tx, mut rx) =
@@ -69,26 +74,14 @@ impl ExecutionProxy {
                 callback();
             }
         });
-        let (commit_tx, mut commit_rx) =
-            channel::new::(10, &counters::PENDING_QUORUM_STORE_COMMIT_NOTIFICATION);
-        let notifier = commit_notifier.clone();
-        handle.spawn(async move {
-            while let Some((epoch, round)) = commit_rx.next().await {
-                if let Err(e) =
-                    monitor!("notify_commit", notifier.notify_commit(epoch, round).await)
-                {
-                    error!(error = ?e, "Failed to notify commit notifier");
-                }
-            }
-        });
         Self {
             executor,
             txn_notifier,
             state_sync_notifier,
             async_state_sync_notifier: tx,
-            async_commit_notifier: commit_tx,
             validators: Mutex::new(vec![]),
             write_mutex: AsyncMutex::new(()),
+            payload_manager: Mutex::new(None),
         }
     }
 }
@@ -114,9 +107,15 @@ impl StateComputer for ExecutionProxy {
             "Executing block",
         );
 
+        let payload_manager = self.payload_manager.lock().as_ref().unwrap().clone();
+        let txns = payload_manager.get_transactions(block).await?;
+
         // TODO: figure out error handling for the prologue txn
         let executor = self.executor.clone();
-        let transactions_to_execute = block.transactions_to_execute(&self.validators.lock());
+
+        let transactions_to_execute =
+            block.transactions_to_execute(&self.validators.lock(), txns.clone());
+
         let compute_result = monitor!(
             "execute_block",
             tokio::task::spawn_blocking(move || {
@@ -130,7 +129,7 @@ impl StateComputer for ExecutionProxy {
         // notify mempool about failed transaction
         if let Err(e) = self
             .txn_notifier
-            .notify_failed_txn(block, &compute_result)
+            .notify_failed_txn(txns, &compute_result)
             .await
         {
             error!(
@@ -155,18 +154,23 @@ impl StateComputer for ExecutionProxy {
         let skip_clean = blocks.is_empty();
         let mut latest_epoch: u64 = 0;
         let mut latest_round: u64 = 0;
+        let mut payloads = Vec::new();
 
+        let payload_manager = self.payload_manager.lock().as_ref().unwrap().clone();
         for block in blocks {
             block_ids.push(block.id());
-            txns.extend(block.transactions_to_commit(&self.validators.lock()));
-            reconfig_events.extend(block.reconfig_event());
 
-            if block.epoch() > latest_epoch {
-                latest_epoch = block.epoch();
-            }
-            if block.round() > latest_round {
-                latest_round = block.round();
+            if let Some(payload) = block.block().payload() {
+                payloads.push(payload.clone());
             }
+
+            let signed_txns = payload_manager.get_transactions(block.block()).await?;
+
+            txns.extend(block.transactions_to_commit(&self.validators.lock(), signed_txns));
+            reconfig_events.extend(block.reconfig_event());
+
+            latest_epoch = max(latest_epoch, block.epoch());
+            latest_round = max(latest_round, block.round());
         }
 
         let executor = self.executor.clone();
@@ -197,11 +201,9 @@ impl StateComputer for ExecutionProxy {
         if skip_clean {
             return Ok(());
         }
-        self.async_commit_notifier
-            .clone()
-            .send((latest_epoch, latest_round))
-            .await
-            .expect("Failed to send async commit notification");
+        payload_manager
+            .notify_commit(LogicalTime::new(latest_epoch, latest_round), payloads)
+            .await;
         Ok(())
     }
 
@@ -213,6 +215,19 @@ impl StateComputer for ExecutionProxy {
         // held by BlockExecutor to prevent memory leak.
         self.executor.finish();
 
+        // This is to update QuorumStore with the latest known commit in the system,
+        // so it can set batches expiration accordingly.
+        //Might be none if called in the recovery path.
+        let maybe_payload_manager = self.payload_manager.lock().as_ref().cloned();
+        if let Some(payload_manager) = maybe_payload_manager {
+            payload_manager
+                .notify_commit(
+                    LogicalTime::new(target.ledger_info().epoch(), target.ledger_info().round()),
+                    Vec::new(),
+                )
+                .await;
+        }
+
         fail_point!("consensus::sync_to", |_| {
             Err(anyhow::anyhow!("Injected error in sync_to").into())
         });
@@ -236,10 +251,11 @@ impl StateComputer for ExecutionProxy {
         })
     }
 
-    fn new_epoch(&self, epoch_state: &EpochState) {
+    fn new_epoch(&self, epoch_state: &EpochState, payload_manager: Arc) {
         *self.validators.lock() = epoch_state
             .verifier
             .get_ordered_account_addresses_iter()
             .collect();
+        self.payload_manager.lock().replace(payload_manager);
     }
 }
diff --git a/consensus/src/state_replication.rs b/consensus/src/state_replication.rs
index 4ca61dfc09742..1050e89415c60 100644
--- a/consensus/src/state_replication.rs
+++ b/consensus/src/state_replication.rs
@@ -2,15 +2,16 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::error::{QuorumStoreError, StateSyncError};
+use crate::payload_manager::PayloadManager;
 use anyhow::Result;
-use aptos_crypto::HashValue;
-use aptos_types::{epoch_state::EpochState, ledger_info::LedgerInfoWithSignatures};
-use consensus_types::{
+use aptos_consensus_types::{
     block::Block,
-    common::{Payload, PayloadFilter},
+    common::{Payload, PayloadFilter, Round},
     executed_block::ExecutedBlock,
 };
-use executor_types::{Error as ExecutionError, StateComputeResult};
+use aptos_crypto::HashValue;
+use aptos_executor_types::{Error as ExecutionError, StateComputeResult};
+use aptos_types::{epoch_state::EpochState, ledger_info::LedgerInfoWithSignatures};
 use futures::future::BoxFuture;
 use std::sync::Arc;
 
@@ -18,9 +19,10 @@ pub type StateComputerCommitCallBackType =
     Box], LedgerInfoWithSignatures) + Send + Sync>;
 
 #[async_trait::async_trait]
-pub trait PayloadManager: Send + Sync {
+pub trait PayloadClient: Send + Sync {
     async fn pull_payload(
         &self,
+        round: Round,
         max_items: u64,
         max_bytes: u64,
         exclude: PayloadFilter,
@@ -62,5 +64,5 @@ pub trait StateComputer: Send + Sync {
     async fn sync_to(&self, target: LedgerInfoWithSignatures) -> Result<(), StateSyncError>;
 
     // Reconfigure to execute transactions for a new epoch.
-    fn new_epoch(&self, epoch_state: &EpochState);
+    fn new_epoch(&self, epoch_state: &EpochState, payload_manager: Arc);
 }
diff --git a/consensus/src/test_utils/mock_payload_manager.rs b/consensus/src/test_utils/mock_payload_manager.rs
index 2d8abd3e8c200..65d72b5980a6f 100644
--- a/consensus/src/test_utils/mock_payload_manager.rs
+++ b/consensus/src/test_utils/mock_payload_manager.rs
@@ -2,18 +2,18 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::{
-    error::QuorumStoreError, payload_manager::QuorumStoreClient, state_replication::PayloadManager,
+    error::QuorumStoreError, payload_client::QuorumStoreClient, state_replication::PayloadClient,
 };
 use anyhow::Result;
+use aptos_consensus_types::{
+    block::block_test_utils::random_payload,
+    common::{Payload, PayloadFilter, Round},
+    request_response::PayloadRequest,
+};
 use aptos_types::{
     transaction::{ExecutionStatus, TransactionStatus},
     vm_status::StatusCode,
 };
-use consensus_types::{
-    block::block_test_utils::random_payload,
-    common::{Payload, PayloadFilter},
-    request_response::ConsensusRequest,
-};
 use futures::{channel::mpsc, future::BoxFuture};
 use rand::Rng;
 
@@ -23,7 +23,7 @@ pub struct MockPayloadManager {
 }
 
 impl MockPayloadManager {
-    pub fn new(consensus_to_quorum_store_sender: Option>) -> Self {
+    pub fn new(consensus_to_quorum_store_sender: Option>) -> Self {
         let quorum_store_client =
             consensus_to_quorum_store_sender.map(|s| QuorumStoreClient::new(s, 1, 1));
         Self {
@@ -47,10 +47,11 @@ fn _mock_transaction_status(count: usize) -> Vec {
 }
 
 #[async_trait::async_trait]
-impl PayloadManager for MockPayloadManager {
+impl PayloadClient for MockPayloadManager {
     /// The returned future is fulfilled with the vector of SignedTransactions
     async fn pull_payload(
         &self,
+        _round: Round,
         _max_size: u64,
         _max_bytes: u64,
         _exclude: PayloadFilter,
diff --git a/consensus/src/test_utils/mock_state_computer.rs b/consensus/src/test_utils/mock_state_computer.rs
index e636e252d1736..37f4b1a9000a6 100644
--- a/consensus/src/test_utils/mock_state_computer.rs
+++ b/consensus/src/test_utils/mock_state_computer.rs
@@ -4,18 +4,19 @@
 use crate::{
     error::StateSyncError,
     experimental::buffer_manager::OrderedBlocks,
+    payload_manager::PayloadManager,
     state_replication::{StateComputer, StateComputerCommitCallBackType},
     test_utils::mock_storage::MockStorage,
 };
 use anyhow::{format_err, Result};
+use aptos_consensus_types::{block::Block, common::Payload, executed_block::ExecutedBlock};
 use aptos_crypto::HashValue;
+use aptos_executor_types::{Error, StateComputeResult};
 use aptos_infallible::Mutex;
 use aptos_logger::prelude::*;
 use aptos_types::{
     epoch_state::EpochState, ledger_info::LedgerInfoWithSignatures, transaction::SignedTransaction,
 };
-use consensus_types::{block::Block, common::Payload, executed_block::ExecutedBlock};
-use executor_types::{Error, StateComputeResult};
 use futures::{channel::mpsc, SinkExt};
 use futures_channel::mpsc::UnboundedSender;
 use std::{collections::HashMap, sync::Arc};
@@ -25,6 +26,7 @@ pub struct MockStateComputer {
     executor_channel: UnboundedSender,
     consensus_db: Arc,
     block_cache: Mutex>,
+    payload_manager: Arc,
 }
 
 impl MockStateComputer {
@@ -38,6 +40,7 @@ impl MockStateComputer {
             executor_channel,
             consensus_db,
             block_cache: Mutex::new(HashMap::new()),
+            payload_manager: Arc::from(PayloadManager::DirectMempool),
         }
     }
 
@@ -50,18 +53,15 @@ impl MockStateComputer {
 
         self.consensus_db
             .commit_to_storage(ordered_proof.ledger_info().clone());
-
         // mock sending commit notif to state sync
         let mut txns = vec![];
         for block in &ordered_blocks {
-            let mut payload = self
-                .block_cache
+            self.block_cache
                 .lock()
                 .remove(&block.id())
-                .ok_or_else(|| format_err!("Cannot find block"))?
-                .into_iter()
-                .collect();
-            txns.append(&mut payload);
+                .ok_or_else(|| format_err!("Cannot find block"))?;
+            let mut payload_txns = self.payload_manager.get_transactions(block.block()).await?;
+            txns.append(&mut payload_txns);
         }
         // they may fail during shutdown
         let _ = self.state_sync_client.unbounded_send(txns);
@@ -84,7 +84,7 @@ impl StateComputer for MockStateComputer {
     ) -> Result {
         self.block_cache.lock().insert(
             block.id(),
-            block.payload().unwrap_or(&Payload::empty()).clone(),
+            block.payload().unwrap_or(&Payload::empty(false)).clone(),
         );
         let result = StateComputeResult::new_dummy();
         Ok(result)
@@ -131,7 +131,7 @@ impl StateComputer for MockStateComputer {
         Ok(())
     }
 
-    fn new_epoch(&self, _: &EpochState) {}
+    fn new_epoch(&self, _: &EpochState, _: Arc) {}
 }
 
 pub struct EmptyStateComputer;
@@ -159,7 +159,7 @@ impl StateComputer for EmptyStateComputer {
         Ok(())
     }
 
-    fn new_epoch(&self, _: &EpochState) {}
+    fn new_epoch(&self, _: &EpochState, _: Arc) {}
 }
 
 /// Random Compute Result State Computer
@@ -210,5 +210,5 @@ impl StateComputer for RandomComputeResultStateComputer {
         Ok(())
     }
 
-    fn new_epoch(&self, _: &EpochState) {}
+    fn new_epoch(&self, _: &EpochState, _: Arc) {}
 }
diff --git a/consensus/src/test_utils/mock_storage.rs b/consensus/src/test_utils/mock_storage.rs
index 5c71e3a31990c..ce323c562787c 100644
--- a/consensus/src/test_utils/mock_storage.rs
+++ b/consensus/src/test_utils/mock_storage.rs
@@ -8,6 +8,9 @@ use crate::{
     },
 };
 use anyhow::Result;
+use aptos_consensus_types::{
+    block::Block, quorum_cert::QuorumCert, timeout_2chain::TwoChainTimeoutCertificate, vote::Vote,
+};
 use aptos_crypto::HashValue;
 use aptos_infallible::Mutex;
 use aptos_types::{
@@ -16,9 +19,6 @@ use aptos_types::{
     ledger_info::{LedgerInfo, LedgerInfoWithSignatures},
     on_chain_config::ValidatorSet,
 };
-use consensus_types::{
-    block::Block, quorum_cert::QuorumCert, timeout_2chain::TwoChainTimeoutCertificate, vote::Vote,
-};
 use std::{collections::HashMap, sync::Arc};
 use storage_interface::DbReader;
 
diff --git a/consensus/src/test_utils/mod.rs b/consensus/src/test_utils/mod.rs
index fe134e7a99680..198de2979cf4d 100644
--- a/consensus/src/test_utils/mod.rs
+++ b/consensus/src/test_utils/mod.rs
@@ -2,16 +2,16 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::block_storage::{BlockReader, BlockStore};
-use aptos_crypto::HashValue;
-use aptos_logger::Level;
-use aptos_types::{ledger_info::LedgerInfo, validator_signer::ValidatorSigner};
-use consensus_types::{
+use aptos_consensus_types::{
     block::{block_test_utils::certificate_for_genesis, Block},
     common::{Author, Round},
     executed_block::ExecutedBlock,
     quorum_cert::QuorumCert,
     sync_info::SyncInfo,
 };
+use aptos_crypto::HashValue;
+use aptos_logger::Level;
+use aptos_types::{ledger_info::LedgerInfo, validator_signer::ValidatorSigner};
 use std::{future::Future, sync::Arc, time::Duration};
 use tokio::{runtime, time::timeout};
 
@@ -20,9 +20,9 @@ mod mock_payload_manager;
 mod mock_state_computer;
 mod mock_storage;
 
-use crate::util::mock_time_service::SimulatedTimeService;
+use crate::{payload_manager::PayloadManager, util::mock_time_service::SimulatedTimeService};
+use aptos_consensus_types::{block::block_test_utils::gen_test_certificate, common::Payload};
 use aptos_types::block_info::BlockInfo;
-use consensus_types::{block::block_test_utils::gen_test_certificate, common::Payload};
 pub use mock_payload_manager::MockPayloadManager;
 pub use mock_state_computer::{
     EmptyStateComputer, MockStateComputer, RandomComputeResultStateComputer,
@@ -74,6 +74,7 @@ pub fn build_empty_tree() -> Arc {
         10, // max pruned blocks in mem
         Arc::new(SimulatedTimeService::new()),
         10,
+        Arc::from(PayloadManager::DirectMempool),
     ))
 }
 
@@ -135,7 +136,7 @@ impl TreeInserter {
                 parent_qc,
                 parent.timestamp_usecs() + 1,
                 round,
-                Payload::empty(),
+                Payload::empty(false),
                 vec![],
             ))
             .await
diff --git a/consensus/src/twins/basic_twins_test.rs b/consensus/src/twins/basic_twins_test.rs
index cd3aab87849ff..fe529abbcd778 100644
--- a/consensus/src/twins/basic_twins_test.rs
+++ b/consensus/src/twins/basic_twins_test.rs
@@ -7,10 +7,10 @@ use crate::{
     test_utils::{consensus_runtime, timed_block_on},
     twins::twins_node::SMRNode,
 };
+use aptos_consensus_types::{block::Block, common::Round};
 use aptos_types::on_chain_config::ProposerElectionType::{
     FixedProposer, RotatingProposer, RoundProposer,
 };
-use consensus_types::{block::Block, common::Round};
 use futures::StreamExt;
 use std::collections::HashMap;
 
diff --git a/consensus/src/twins/twins_node.rs b/consensus/src/twins/twins_node.rs
index 9695984660e9b..00e22343cf207 100644
--- a/consensus/src/twins/twins_node.rs
+++ b/consensus/src/twins/twins_node.rs
@@ -2,13 +2,13 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::{
-    commit_notifier::QuorumStoreCommitNotifier,
     counters,
     epoch_manager::EpochManager,
     experimental::buffer_manager::OrderedBlocks,
     network::NetworkTask,
     network_interface::{ConsensusNetworkEvents, ConsensusNetworkSender},
     network_tests::{NetworkPlayground, TwinId},
+    payload_manager::PayloadManager,
     test_utils::{MockStateComputer, MockStorage},
     util::time_service::ClockTimeService,
 };
@@ -17,6 +17,8 @@ use aptos_config::{
     generator::{self, ValidatorSwarm},
     network_id::NetworkId,
 };
+use aptos_consensus_types::common::{Author, Round};
+use aptos_event_notifications::{ReconfigNotification, ReconfigNotificationListener};
 use aptos_mempool::mocks::MockSharedMempool;
 use aptos_types::{
     ledger_info::LedgerInfoWithSignatures,
@@ -30,8 +32,6 @@ use aptos_types::{
     waypoint::Waypoint,
 };
 use channel::{self, aptos_channel, message_queues::QueueStyle};
-use consensus_types::common::{Author, Round};
-use event_notifications::{ReconfigNotification, ReconfigNotificationListener};
 use futures::channel::mpsc;
 use futures::StreamExt;
 use network::{
@@ -95,7 +95,7 @@ impl SMRNode {
         let reconfig_listener = ReconfigNotificationListener {
             notification_receiver: reconfig_events,
         };
-        let commit_notifier = Arc::new(QuorumStoreCommitNotifier::new(1_000));
+        let _commit_notifier = Arc::from(PayloadManager::DirectMempool);
         let mut configs = HashMap::new();
         configs.insert(
             ValidatorSet::CONFIG_ID,
@@ -145,7 +145,6 @@ impl SMRNode {
             state_computer.clone(),
             storage.clone(),
             reconfig_listener,
-            commit_notifier,
         );
         let (network_task, network_receiver) = NetworkTask::new(network_events, self_receiver);
 
diff --git a/consensus/src/txn_notifier.rs b/consensus/src/txn_notifier.rs
index 1bc478e1129e9..faa19f7e0ad3b 100644
--- a/consensus/src/txn_notifier.rs
+++ b/consensus/src/txn_notifier.rs
@@ -3,10 +3,10 @@
 
 use crate::{error::MempoolError, monitor};
 use anyhow::{format_err, Result};
+use aptos_consensus_types::common::RejectedTransactionSummary;
+use aptos_executor_types::StateComputeResult;
 use aptos_mempool::QuorumStoreRequest;
-use aptos_types::transaction::TransactionStatus;
-use consensus_types::{block::Block, common::RejectedTransactionSummary};
-use executor_types::StateComputeResult;
+use aptos_types::transaction::{SignedTransaction, TransactionStatus};
 use futures::channel::{mpsc, oneshot};
 use itertools::Itertools;
 use std::time::Duration;
@@ -19,7 +19,7 @@ pub trait TxnNotifier: Send + Sync {
     /// state sync.)
     async fn notify_failed_txn(
         &self,
-        block: &Block,
+        txns: Vec,
         compute_results: &StateComputeResult,
     ) -> Result<(), MempoolError>;
 }
@@ -48,17 +48,10 @@ impl MempoolNotifier {
 impl TxnNotifier for MempoolNotifier {
     async fn notify_failed_txn(
         &self,
-        block: &Block,
+        txns: Vec,
         compute_results: &StateComputeResult,
     ) -> Result<(), MempoolError> {
         let mut rejected_txns = vec![];
-        let txns: Vec<_> = match block.payload() {
-            Some(payload) => payload,
-            None => return Ok(()),
-        }
-        .clone()
-        .into_iter()
-        .collect();
 
         if txns.is_empty() {
             return Ok(());
diff --git a/crates/aptos-genesis/Cargo.toml b/crates/aptos-genesis/Cargo.toml
index 79d2a0bf31ba8..ed22220abe8bf 100644
--- a/crates/aptos-genesis/Cargo.toml
+++ b/crates/aptos-genesis/Cargo.toml
@@ -14,8 +14,11 @@ rust-version = { workspace = true }
 
 [dependencies]
 anyhow = { workspace = true }
+aptos-cached-packages = { workspace = true }
 aptos-config = { workspace = true }
 aptos-crypto = { workspace = true }
+aptos-executor = { workspace = true }
+aptos-framework = { workspace = true }
 aptos-keygen = { workspace = true }
 aptos-logger = { workspace = true }
 aptos-state-view =  { workspace = true }
@@ -24,9 +27,6 @@ aptos-types = { workspace = true }
 aptos-vm = { workspace = true }
 aptosdb = { workspace = true }
 bcs = { workspace = true }
-cached-packages = { workspace = true }
-executor = { workspace = true }
-framework = { workspace = true }
 rand = { workspace = true }
 serde = { workspace = true }
 serde_yaml = { workspace = true }
diff --git a/crates/aptos-genesis/src/builder.rs b/crates/aptos-genesis/src/builder.rs
index ec0c5ceb32bef..cb74f74c4a1c9 100644
--- a/crates/aptos-genesis/src/builder.rs
+++ b/crates/aptos-genesis/src/builder.rs
@@ -22,6 +22,7 @@ use aptos_crypto::{
     ed25519::{Ed25519PrivateKey, Ed25519PublicKey},
     PrivateKey,
 };
+use aptos_framework::ReleaseBundle;
 use aptos_keygen::KeyGen;
 use aptos_logger::prelude::*;
 use aptos_types::{
@@ -30,7 +31,6 @@ use aptos_types::{
     transaction::Transaction,
     waypoint::Waypoint,
 };
-use framework::ReleaseBundle;
 use rand::Rng;
 use serde::{de::DeserializeOwned, Serialize};
 use std::{
diff --git a/crates/aptos-genesis/src/lib.rs b/crates/aptos-genesis/src/lib.rs
index 1cbb23187cabf..2b5fee499a397 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_framework::ReleaseBundle;
 use aptos_temppath::TempPath;
 use aptos_types::{
     chain_id::ChainId,
@@ -26,7 +27,6 @@ use aptos_types::{
 };
 use aptos_vm::AptosVM;
 use aptosdb::AptosDB;
-use framework::ReleaseBundle;
 use std::convert::TryInto;
 use storage_interface::DbReaderWriter;
 use vm_genesis::Validator;
@@ -155,6 +155,6 @@ impl GenesisInfo {
             DEFAULT_MAX_NUM_NODES_PER_LRU_CACHE_SHARD,
         )?;
         let db_rw = DbReaderWriter::new(aptosdb);
-        executor::db_bootstrapper::generate_waypoint::(&db_rw, genesis)
+        aptos_executor::db_bootstrapper::generate_waypoint::(&db_rw, genesis)
     }
 }
diff --git a/crates/aptos-genesis/src/mainnet.rs b/crates/aptos-genesis/src/mainnet.rs
index c2740d85c093a..878e789aa47d8 100644
--- a/crates/aptos-genesis/src/mainnet.rs
+++ b/crates/aptos-genesis/src/mainnet.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_framework::ReleaseBundle;
 use aptos_temppath::TempPath;
 use aptos_types::{chain_id::ChainId, transaction::Transaction, waypoint::Waypoint};
 use aptos_vm::AptosVM;
 use aptosdb::AptosDB;
-use framework::ReleaseBundle;
 use storage_interface::DbReaderWriter;
 use vm_genesis::{AccountBalance, EmployeePool, ValidatorWithCommissionRate};
 
@@ -143,6 +143,6 @@ impl MainnetGenesisInfo {
             DEFAULT_MAX_NUM_NODES_PER_LRU_CACHE_SHARD,
         )?;
         let db_rw = DbReaderWriter::new(aptosdb);
-        executor::db_bootstrapper::generate_waypoint::(&db_rw, genesis)
+        aptos_executor::db_bootstrapper::generate_waypoint::(&db_rw, genesis)
     }
 }
diff --git a/crates/aptos-genesis/src/test_utils.rs b/crates/aptos-genesis/src/test_utils.rs
index d76f79f19dbaf..2d2ba8ca8154b 100644
--- a/crates/aptos-genesis/src/test_utils.rs
+++ b/crates/aptos-genesis/src/test_utils.rs
@@ -9,11 +9,13 @@ use rand::{rngs::StdRng, SeedableRng};
 pub fn test_config() -> (NodeConfig, Ed25519PrivateKey) {
     let path = TempPath::new();
     path.create_as_dir().unwrap();
-    let (root_key, _genesis, _genesis_waypoint, validators) =
-        crate::builder::Builder::new(path.path(), cached_packages::head_release_bundle().clone())
-            .unwrap()
-            .build(StdRng::from_seed([0; 32]))
-            .unwrap();
+    let (root_key, _genesis, _genesis_waypoint, validators) = crate::builder::Builder::new(
+        path.path(),
+        aptos_cached_packages::head_release_bundle().clone(),
+    )
+    .unwrap()
+    .build(StdRng::from_seed([0; 32]))
+    .unwrap();
     let (
         IdentityBlob {
             account_address,
diff --git a/crates/aptos-infallible/src/mutex.rs b/crates/aptos-infallible/src/mutex.rs
index d8595d8e1fca0..9605b6b8a7987 100644
--- a/crates/aptos-infallible/src/mutex.rs
+++ b/crates/aptos-infallible/src/mutex.rs
@@ -7,7 +7,7 @@ pub use std::sync::MutexGuard;
 
 /// A simple wrapper around the lock() function of a std::sync::Mutex
 /// The only difference is that you don't need to call unwrap() on it.
-#[derive(Debug)]
+#[derive(Debug, Default)]
 pub struct Mutex(StdMutex);
 
 impl Mutex {
diff --git a/crates/aptos-rest-client/src/lib.rs b/crates/aptos-rest-client/src/lib.rs
index 16bf496f4c3c3..e6a48850ffd3e 100644
--- a/crates/aptos-rest-client/src/lib.rs
+++ b/crates/aptos-rest-client/src/lib.rs
@@ -24,9 +24,9 @@ use anyhow::{anyhow, Result};
 use aptos_api_types::{
     deserialize_from_string,
     mime_types::{BCS, BCS_SIGNED_TRANSACTION as BCS_CONTENT_TYPE},
-    AptosError, BcsBlock, Block, Bytecode, ExplainVMStatus, GasEstimation, HexEncodedBytes,
-    IndexResponse, MoveModuleId, TransactionData, TransactionOnChainData,
-    TransactionsBatchSubmissionResult, UserTransaction, VersionedEvent,
+    AptosError, BcsBlock, Block, GasEstimation, HexEncodedBytes, IndexResponse, MoveModuleId,
+    TransactionData, TransactionOnChainData, TransactionsBatchSubmissionResult, UserTransaction,
+    VersionedEvent,
 };
 use aptos_crypto::HashValue;
 use aptos_logger::{debug, info, sample, sample::SampleRate};
@@ -36,16 +36,13 @@ use aptos_types::{
     contract_event::EventWithVersion,
     transaction::SignedTransaction,
 };
-use futures::executor::block_on;
-use move_binary_format::CompiledModule;
-use move_core_types::language_storage::{ModuleId, StructTag};
+use move_core_types::language_storage::StructTag;
 use reqwest::header::ACCEPT;
 use reqwest::{header::CONTENT_TYPE, Client as ReqwestClient, StatusCode};
 use serde::{de::DeserializeOwned, Deserialize, Serialize};
 use serde_json::{json, Value};
 use std::collections::BTreeMap;
 use std::future::Future;
-use std::rc::Rc;
 use std::time::Duration;
 use tokio::time::Instant;
 use url::Url;
@@ -326,6 +323,30 @@ impl Client {
         self.json(response).await
     }
 
+    pub async fn simulate_with_gas_estimation(
+        &self,
+        txn: &SignedTransaction,
+        estimate_max_gas_amount: bool,
+        estimate_max_gas_unit_price: bool,
+    ) -> AptosResult>> {
+        let txn_payload = bcs::to_bytes(txn)?;
+
+        let url = self.build_path(&format!(
+            "transactions/simulate?estimate_max_gas_amount={}&estimate_gas_unit_price={}",
+            estimate_max_gas_amount, estimate_max_gas_unit_price
+        ))?;
+
+        let response = self
+            .inner
+            .post(url)
+            .header(CONTENT_TYPE, BCS_CONTENT_TYPE)
+            .body(txn_payload)
+            .send()
+            .await?;
+
+        self.json(response).await
+    }
+
     pub async fn simulate_bcs(
         &self,
         txn: &SignedTransaction,
@@ -1550,15 +1571,3 @@ enum WaitForTransactionResult {
     Pending(State),
     Success(Response),
 }
-
-impl ExplainVMStatus for Client {
-    // TODO: Add some caching
-    fn get_module_bytecode(&self, module_id: &ModuleId) -> Result> {
-        let bytes =
-            block_on(self.get_account_module_bcs(*module_id.address(), module_id.name().as_str()))?
-                .into_inner();
-
-        let compiled_module = CompiledModule::deserialize(bytes.as_ref())?;
-        Ok(Rc::new(compiled_module) as Rc)
-    }
-}
diff --git a/crates/aptos-rosetta/Cargo.toml b/crates/aptos-rosetta/Cargo.toml
index c8952b9e16e7f..967135ddc379d 100644
--- a/crates/aptos-rosetta/Cargo.toml
+++ b/crates/aptos-rosetta/Cargo.toml
@@ -14,6 +14,7 @@ rust-version = { workspace = true }
 
 [dependencies]
 anyhow = { workspace = true }
+aptos-cached-packages = { workspace = true }
 aptos-config = { workspace = true }
 aptos-crypto = { workspace = true }
 aptos-global-constants = { workspace = true }
@@ -24,7 +25,6 @@ aptos-sdk = { workspace = true }
 aptos-types = { workspace = true }
 aptos-warp-webserver = { workspace = true }
 bcs = { workspace = true }
-cached-packages = { workspace = true }
 clap = { workspace = true }
 futures = { workspace = true }
 hex = { workspace = true }
diff --git a/crates/aptos-rosetta/src/types/objects.rs b/crates/aptos-rosetta/src/types/objects.rs
index ef68d266cf461..1f2a2e6ebe203 100644
--- a/crates/aptos-rosetta/src/types/objects.rs
+++ b/crates/aptos-rosetta/src/types/objects.rs
@@ -21,6 +21,7 @@ use crate::{
     ApiError, RosettaContext,
 };
 use anyhow::anyhow;
+use aptos_cached_packages::aptos_stdlib;
 use aptos_crypto::{ed25519::Ed25519PublicKey, ValidCryptoMaterialStringExt};
 use aptos_logger::warn;
 use aptos_rest_client::aptos_api_types::TransactionOnChainData;
@@ -32,7 +33,6 @@ use aptos_types::state_store::state_key::StateKey;
 use aptos_types::transaction::{EntryFunction, TransactionPayload};
 use aptos_types::write_set::{WriteOp, WriteSet};
 use aptos_types::{account_address::AccountAddress, event::EventKey};
-use cached_packages::aptos_stdlib;
 use itertools::Itertools;
 use serde::{Deserialize, Serialize};
 use std::cmp::Ordering;
diff --git a/crates/aptos-telemetry/Cargo.toml b/crates/aptos-telemetry/Cargo.toml
index 79ded462ec2b3..45baec74131e1 100644
--- a/crates/aptos-telemetry/Cargo.toml
+++ b/crates/aptos-telemetry/Cargo.toml
@@ -16,6 +16,7 @@ rust-version = { workspace = true }
 anyhow = { workspace = true }
 aptos-api = { workspace = true }
 aptos-config = { workspace = true }
+aptos-consensus = { workspace = true }
 aptos-crypto = { workspace = true }
 aptos-infallible = { workspace = true }
 aptos-logger = { workspace = true }
@@ -24,7 +25,6 @@ aptos-metrics-core = { workspace = true }
 aptos-telemetry-service = { workspace = true }
 aptos-types = { workspace = true }
 aptosdb = { workspace = true }
-consensus = { workspace = true }
 flate2 = { workspace = true }
 futures = { workspace = true }
 network = { workspace = true }
diff --git a/crates/aptos-telemetry/src/core_metrics.rs b/crates/aptos-telemetry/src/core_metrics.rs
index e2a2be5950fe2..6845bd432c044 100644
--- a/crates/aptos-telemetry/src/core_metrics.rs
+++ b/crates/aptos-telemetry/src/core_metrics.rs
@@ -67,15 +67,17 @@ fn collect_core_metrics(core_metrics: &mut BTreeMap, node_config
 fn collect_consensus_metrics(core_metrics: &mut BTreeMap) {
     core_metrics.insert(
         CONSENSUS_PROPOSALS_COUNT.into(),
-        consensus::counters::PROPOSALS_COUNT.get().to_string(),
+        aptos_consensus::counters::PROPOSALS_COUNT.get().to_string(),
     );
     core_metrics.insert(
         CONSENSUS_LAST_COMMITTED_ROUND.into(),
-        consensus::counters::LAST_COMMITTED_ROUND.get().to_string(),
+        aptos_consensus::counters::LAST_COMMITTED_ROUND
+            .get()
+            .to_string(),
     );
     core_metrics.insert(
         CONSENSUS_TIMEOUT_COUNT.into(),
-        consensus::counters::TIMEOUT_COUNT.get().to_string(),
+        aptos_consensus::counters::TIMEOUT_COUNT.get().to_string(),
     );
     //TODO(joshlind): add block tracing and back pressure!
 }
diff --git a/crates/aptos/Cargo.toml b/crates/aptos/Cargo.toml
index cde03761c040c..16eec4ff992ea 100644
--- a/crates/aptos/Cargo.toml
+++ b/crates/aptos/Cargo.toml
@@ -17,9 +17,11 @@ anyhow = { workspace = true }
 aptos-backup-cli = { workspace = true }
 aptos-bitvec = { workspace = true }
 aptos-build-info = { workspace = true }
+aptos-cached-packages = { workspace = true }
 aptos-config = { workspace = true }
 aptos-crypto = { workspace = true }
 aptos-faucet = { workspace = true }
+aptos-framework = { workspace = true }
 aptos-gas = { workspace = true }
 aptos-genesis = { workspace = true }
 aptos-github-client = { workspace = true }
@@ -38,12 +40,10 @@ aptos-vm = { workspace = true, features = ["testing"] }
 async-trait = { workspace = true }
 base64 = { workspace = true }
 bcs = { workspace = true }
-cached-packages = { workspace = true }
 chrono = { workspace = true }
 clap = { workspace = true }
 clap_complete = { workspace = true }
 dirs = { workspace = true }
-framework = { workspace = true }
 futures = { workspace = true }
 hex = { workspace = true }
 itertools = { workspace = true }
diff --git a/crates/aptos/src/account/create.rs b/crates/aptos/src/account/create.rs
index d68126f42517d..87b64b009e34a 100644
--- a/crates/aptos/src/account/create.rs
+++ b/crates/aptos/src/account/create.rs
@@ -2,9 +2,9 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::common::types::{CliCommand, CliTypedResult, TransactionOptions, TransactionSummary};
+use aptos_cached_packages::aptos_stdlib;
 use aptos_types::account_address::AccountAddress;
 use async_trait::async_trait;
-use cached_packages::aptos_stdlib;
 use clap::Parser;
 
 // 1 APT
diff --git a/crates/aptos/src/account/create_resource_account.rs b/crates/aptos/src/account/create_resource_account.rs
index d3655f7c9aa7f..5623ee5c36143 100644
--- a/crates/aptos/src/account/create_resource_account.rs
+++ b/crates/aptos/src/account/create_resource_account.rs
@@ -2,13 +2,13 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::common::types::{CliCommand, CliTypedResult, TransactionOptions, TransactionSummary};
+use aptos_cached_packages::aptos_stdlib::resource_account_create_resource_account;
 use aptos_rest_client::{
     aptos_api_types::{WriteResource, WriteSetChange},
     Transaction,
 };
 use aptos_types::{account_address::AccountAddress, transaction::authenticator::AuthenticationKey};
 use async_trait::async_trait;
-use cached_packages::aptos_stdlib::resource_account_create_resource_account;
 use clap::Parser;
 use serde::Serialize;
 use std::str::FromStr;
diff --git a/crates/aptos/src/account/key_rotation.rs b/crates/aptos/src/account/key_rotation.rs
index 9ffe879f9abcf..f120a8f1e771b 100644
--- a/crates/aptos/src/account/key_rotation.rs
+++ b/crates/aptos/src/account/key_rotation.rs
@@ -11,6 +11,7 @@ use crate::common::{
     },
     utils::{prompt_yes_with_override, read_line},
 };
+use aptos_cached_packages::aptos_stdlib;
 use aptos_crypto::{
     ed25519::{Ed25519PrivateKey, Ed25519PublicKey},
     PrivateKey, SigningKey,
@@ -23,7 +24,6 @@ use aptos_types::{
     transaction::authenticator::AuthenticationKey,
 };
 use async_trait::async_trait;
-use cached_packages::aptos_stdlib;
 use clap::Parser;
 use serde::{Deserialize, Serialize};
 use std::{collections::BTreeMap, path::PathBuf};
diff --git a/crates/aptos/src/account/transfer.rs b/crates/aptos/src/account/transfer.rs
index f4d12573f72cc..cf1a306f84b30 100644
--- a/crates/aptos/src/account/transfer.rs
+++ b/crates/aptos/src/account/transfer.rs
@@ -2,6 +2,7 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use crate::common::types::{CliCommand, CliTypedResult, TransactionOptions};
+use aptos_cached_packages::aptos_stdlib;
 use aptos_rest_client::aptos_api_types::HashValue;
 use aptos_rest_client::{
     aptos_api_types::{WriteResource, WriteSetChange},
@@ -9,7 +10,6 @@ use aptos_rest_client::{
 };
 use aptos_types::account_address::AccountAddress;
 use async_trait::async_trait;
-use cached_packages::aptos_stdlib;
 use clap::Parser;
 use serde::Serialize;
 use std::collections::BTreeMap;
diff --git a/crates/aptos/src/common/types.rs b/crates/aptos/src/common/types.rs
index 612319113bb1b..6140b26f675e2 100644
--- a/crates/aptos/src/common/types.rs
+++ b/crates/aptos/src/common/types.rs
@@ -19,7 +19,7 @@ use aptos_crypto::{
 };
 use aptos_global_constants::adjust_gas_headroom;
 use aptos_keygen::KeyGen;
-use aptos_rest_client::aptos_api_types::{ExplainVMStatus, HashValue, UserTransaction};
+use aptos_rest_client::aptos_api_types::HashValue;
 use aptos_rest_client::error::RestError;
 use aptos_rest_client::{Client, Transaction};
 use aptos_sdk::{transaction_builder::TransactionFactory, types::LocalAccount};
@@ -45,7 +45,6 @@ use std::{
 };
 use thiserror::Error;
 
-const MAX_POSSIBLE_GAS_UNITS: u64 = 1_000_000;
 pub const DEFAULT_PROFILE: &str = "default";
 
 /// A common result to be returned to users
@@ -1341,33 +1340,28 @@ impl TransactionOptions {
                 sender_key.public_key(),
                 Ed25519Signature::try_from([0u8; 64].as_ref()).unwrap(),
             );
-            // TODO: Cleanup to use the gas price estimation here
-            let simulated_txn = client
-                .simulate_bcs_with_gas_estimation(&signed_transaction, true, false)
+
+            let txns = client
+                .simulate_with_gas_estimation(&signed_transaction, true, false)
                 .await?
                 .into_inner();
+            let simulated_txn = txns.first().unwrap();
 
             // Check if the transaction will pass, if it doesn't then fail
-            // TODO: Add move resolver so we can explain the VM status with a proper error map
-            let status = simulated_txn.info.status();
-            if !status.is_success() {
-                let status = client.explain_vm_status(status);
-                return Err(CliError::SimulationError(status));
+            if !simulated_txn.info.success {
+                return Err(CliError::SimulationError(
+                    simulated_txn.info.vm_status.clone(),
+                ));
             }
 
             // Take the gas used and use a headroom factor on it
-            let adjusted_max_gas = adjust_gas_headroom(
-                simulated_txn.info.gas_used(),
-                simulated_txn
-                    .transaction
-                    .as_signed_user_txn()
-                    .expect("Should be signed user transaction")
-                    .max_gas_amount(),
-            );
+            let gas_used = simulated_txn.info.gas_used.0;
+            let adjusted_max_gas =
+                adjust_gas_headroom(gas_used, simulated_txn.request.max_gas_amount.0);
 
             // Ask if you want to accept the estimate amount
             let upper_cost_bound = adjusted_max_gas * gas_unit_price;
-            let lower_cost_bound = simulated_txn.info.gas_used() * gas_unit_price;
+            let lower_cost_bound = gas_used * gas_unit_price;
             let message = format!(
                     "Do you want to submit a transaction for a range of [{} - {}] Octas at a gas unit price of {} Octas?",
                     lower_cost_bound,
@@ -1392,69 +1386,6 @@ impl TransactionOptions {
         Ok(response.into_inner())
     }
 
-    pub async fn simulate_transaction(
-        &self,
-        payload: TransactionPayload,
-        gas_price: Option,
-        amount_transfer: Option,
-    ) -> CliTypedResult {
-        let client = self.rest_client()?;
-        let (sender_key, sender_address) = self.get_key_and_address()?;
-
-        // Get sequence number for account
-        let sequence_number = get_sequence_number(&client, sender_address).await?;
-
-        // Estimate gas price if necessary
-        let gas_price = if let Some(gas_price) = gas_price {
-            gas_price
-        } else {
-            self.estimate_gas_price().await?
-        };
-        // Simulate transaction
-        // To get my known possible max gas, I need to get my current balance
-        let account_balance = client
-            .get_account_balance(sender_address)
-            .await?
-            .into_inner()
-            .coin
-            .value
-            .0;
-
-        let max_possible_gas = if gas_price == 0 {
-            MAX_POSSIBLE_GAS_UNITS
-        } else if let Some(amount) = amount_transfer {
-            std::cmp::min(
-                account_balance
-                    .saturating_sub(amount)
-                    .saturating_div(gas_price),
-                MAX_POSSIBLE_GAS_UNITS,
-            )
-        } else {
-            std::cmp::min(
-                account_balance.saturating_div(gas_price),
-                MAX_POSSIBLE_GAS_UNITS,
-            )
-        };
-
-        let transaction_factory = TransactionFactory::new(chain_id(&client).await?)
-            .with_gas_unit_price(gas_price)
-            .with_max_gas_amount(max_possible_gas);
-
-        let unsigned_transaction = transaction_factory
-            .payload(payload)
-            .sender(sender_address)
-            .sequence_number(sequence_number)
-            .build();
-
-        let signed_transaction = SignedTransaction::new(
-            unsigned_transaction,
-            sender_key.public_key(),
-            Ed25519Signature::try_from([0u8; 64].as_ref()).unwrap(),
-        );
-        let txns = client.simulate(&signed_transaction).await?.into_inner();
-        Ok(txns.first().unwrap().clone())
-    }
-
     pub async fn estimate_gas_price(&self) -> CliTypedResult {
         let client = self.rest_client()?;
         client
diff --git a/crates/aptos/src/genesis/git.rs b/crates/aptos/src/genesis/git.rs
index 1dde29bdf988b..804f01f1e45aa 100644
--- a/crates/aptos/src/genesis/git.rs
+++ b/crates/aptos/src/genesis/git.rs
@@ -10,11 +10,11 @@ use crate::{
     CliCommand,
 };
 use aptos_config::config::Token;
+use aptos_framework::ReleaseBundle;
 use aptos_genesis::config::Layout;
 use aptos_github_client::Client as GithubClient;
 use async_trait::async_trait;
 use clap::Parser;
-use framework::ReleaseBundle;
 use serde::{de::DeserializeOwned, Serialize};
 use std::path::Path;
 use std::{fmt::Debug, io::Read, path::PathBuf, str::FromStr};
diff --git a/crates/aptos/src/genesis/tests.rs b/crates/aptos/src/genesis/tests.rs
index ed809cf7252ff..7186b92382890 100644
--- a/crates/aptos/src/genesis/tests.rs
+++ b/crates/aptos/src/genesis/tests.rs
@@ -258,7 +258,7 @@ async fn setup_git_dir(
 
 /// Add framework to git directory
 fn add_framework_to_dir(git_dir: &Path) {
-    cached_packages::head_release_bundle()
+    aptos_cached_packages::head_release_bundle()
         .write(git_dir.join(FRAMEWORK_NAME))
         .unwrap()
 }
diff --git a/crates/aptos/src/governance/mod.rs b/crates/aptos/src/governance/mod.rs
index a2dcd7e61718f..e0ace5e416ad5 100644
--- a/crates/aptos/src/governance/mod.rs
+++ b/crates/aptos/src/governance/mod.rs
@@ -10,7 +10,9 @@ use crate::common::utils::prompt_yes_with_override;
 use crate::common::utils::read_from_file;
 use crate::move_tool::{FrameworkPackageArgs, IncludedArtifacts};
 use crate::{CliCommand, CliResult};
+use aptos_cached_packages::aptos_stdlib;
 use aptos_crypto::HashValue;
+use aptos_framework::{BuildOptions, BuiltPackage, ReleasePackage};
 use aptos_logger::warn;
 use aptos_rest_client::aptos_api_types::{Address, HexEncodedBytes, U128, U64};
 use aptos_rest_client::{Client, Transaction};
@@ -24,9 +26,7 @@ use aptos_types::{
     transaction::{Script, TransactionPayload},
 };
 use async_trait::async_trait;
-use cached_packages::aptos_stdlib;
 use clap::Parser;
-use framework::{BuildOptions, BuiltPackage, ReleasePackage};
 use move_core_types::transaction_argument::TransactionArgument;
 use reqwest::Url;
 use serde::Deserialize;
diff --git a/crates/aptos/src/move_tool/mod.rs b/crates/aptos/src/move_tool/mod.rs
index 668f7ef6cca1b..aa180987a3ff4 100644
--- a/crates/aptos/src/move_tool/mod.rs
+++ b/crates/aptos/src/move_tool/mod.rs
@@ -29,6 +29,10 @@ use crate::{
     },
     CliCommand, CliResult,
 };
+use aptos_framework::docgen::DocgenOptions;
+use aptos_framework::natives::code::UpgradePolicy;
+use aptos_framework::prover::ProverOptions;
+use aptos_framework::{BuildOptions, BuiltPackage};
 use aptos_gas::{AbstractValueSizeGasParameters, NativeGasParameters};
 use aptos_module_verifier::module_init::verify_module_init_function;
 use aptos_rest_client::aptos_api_types::MoveType;
@@ -37,10 +41,6 @@ use aptos_types::account_address::{create_resource_address, AccountAddress};
 use aptos_types::transaction::{EntryFunction, Script, TransactionArgument, TransactionPayload};
 use async_trait::async_trait;
 use clap::{ArgEnum, Parser, Subcommand};
-use framework::docgen::DocgenOptions;
-use framework::natives::code::UpgradePolicy;
-use framework::prover::ProverOptions;
-use framework::{BuildOptions, BuiltPackage};
 use itertools::Itertools;
 use move_cli::base::test::UnitTestResult;
 use move_command_line_common::env::MOVE_HOME;
@@ -597,7 +597,7 @@ impl CliCommand for PublishPackage {
 
         // Send the compiled module and metadata using the code::publish_package_txn.
         let metadata = package.extract_metadata()?;
-        let payload = cached_packages::aptos_stdlib::code_publish_package_txn(
+        let payload = aptos_cached_packages::aptos_stdlib::code_publish_package_txn(
             bcs::to_bytes(&metadata).expect("PackageMetadata has BCS"),
             compiled_units,
         );
@@ -689,7 +689,7 @@ impl CliCommand for CreateResourceAccountAndPublishPackage {
         );
         prompt_yes_with_override(&message, txn_options.prompt_options)?;
 
-        let payload = cached_packages::aptos_stdlib::resource_account_create_resource_account_and_publish_package(
+        let payload = aptos_cached_packages::aptos_stdlib::resource_account_create_resource_account_and_publish_package(
             bcs::to_bytes(&seed)?,
             bcs::to_bytes(&metadata).expect("PackageMetadata has BCS"),
             compiled_units,
diff --git a/crates/aptos/src/move_tool/package_hooks.rs b/crates/aptos/src/move_tool/package_hooks.rs
index 5af4af6c87b0f..6cc2976c4a733 100644
--- a/crates/aptos/src/move_tool/package_hooks.rs
+++ b/crates/aptos/src/move_tool/package_hooks.rs
@@ -3,7 +3,7 @@
 
 use crate::common::types::load_account_arg;
 use crate::move_tool::CachedPackageRegistry;
-use framework::UPGRADE_POLICY_CUSTOM_FIELD;
+use aptos_framework::UPGRADE_POLICY_CUSTOM_FIELD;
 use futures::executor::block_on;
 use move_package::compilation::package_layout::CompiledPackageLayout;
 use move_package::package_hooks::PackageHooks;
diff --git a/crates/aptos/src/move_tool/stored_package.rs b/crates/aptos/src/move_tool/stored_package.rs
index bcfe9e4e20342..ab06c166c199e 100644
--- a/crates/aptos/src/move_tool/stored_package.rs
+++ b/crates/aptos/src/move_tool/stored_package.rs
@@ -2,10 +2,12 @@
 // SPDX-License-Identifier: Apache-2.0
 
 use anyhow::bail;
+use aptos_framework::natives::code::{
+    ModuleMetadata, PackageMetadata, PackageRegistry, UpgradePolicy,
+};
+use aptos_framework::unzip_metadata_str;
 use aptos_rest_client::Client;
 use aptos_types::account_address::AccountAddress;
-use framework::natives::code::{ModuleMetadata, PackageMetadata, PackageRegistry, UpgradePolicy};
-use framework::unzip_metadata_str;
 use move_package::compilation::package_layout::CompiledPackageLayout;
 use reqwest::Url;
 use std::fs;
diff --git a/crates/aptos/src/node/mod.rs b/crates/aptos/src/node/mod.rs
index 742e3b91e98e1..86addf51783ff 100644
--- a/crates/aptos/src/node/mod.rs
+++ b/crates/aptos/src/node/mod.rs
@@ -26,6 +26,7 @@ use aptos_backup_cli::storage::command_adapter::{config::CommandAdapterConfig, C
 use aptos_backup_cli::utils::{
     ConcurrentDownloadsOpt, GlobalRestoreOpt, ReplayConcurrencyLevelOpt, RocksdbOpt,
 };
+use aptos_cached_packages::aptos_stdlib;
 use aptos_config::config::NodeConfig;
 use aptos_crypto::bls12381::PublicKey;
 use aptos_crypto::{bls12381, x25519, ValidCryptoMaterialStringExt};
@@ -45,7 +46,6 @@ use aptos_types::vesting::VestingAdminStore;
 use aptos_types::{account_address::AccountAddress, account_config::CORE_CODE_ADDRESS};
 use async_trait::async_trait;
 use bcs::Result;
-use cached_packages::aptos_stdlib;
 use chrono::{DateTime, NaiveDateTime, Utc};
 use clap::Parser;
 use hex::FromHex;
@@ -1113,7 +1113,7 @@ impl CliCommand<()> for RunLocalTestnet {
                 Some(test_dir_copy),
                 false,
                 false,
-                cached_packages::head_release_bundle(),
+                aptos_cached_packages::head_release_bundle(),
                 rng,
             );
             eprintln!("Node stopped unexpectedly {:#?}", result);
diff --git a/crates/aptos/src/stake/mod.rs b/crates/aptos/src/stake/mod.rs
index 8859aa13d2e91..fd0af72be0f17 100644
--- a/crates/aptos/src/stake/mod.rs
+++ b/crates/aptos/src/stake/mod.rs
@@ -6,12 +6,12 @@ use crate::common::types::{
 };
 use crate::common::utils::prompt_yes_with_override;
 use crate::node::{get_stake_pools, StakePoolType};
+use aptos_cached_packages::aptos_stdlib;
 use aptos_types::account_address::{
     create_vesting_contract_address, default_stake_pool_address, AccountAddress,
 };
 use aptos_types::vesting::VestingAdminStore;
 use async_trait::async_trait;
-use cached_packages::aptos_stdlib;
 use clap::Parser;
 
 /// Tool for manipulating stake and stake pools
diff --git a/crates/bounded-executor/Cargo.toml b/crates/bounded-executor/Cargo.toml
index 88c3c58135687..1c415b810d5f9 100644
--- a/crates/bounded-executor/Cargo.toml
+++ b/crates/bounded-executor/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "bounded-executor"
+name = "aptos-bounded-executor"
 description = "Executor bounded by number of concurrent tasks"
 version = "0.1.0"
 
diff --git a/crates/crash-handler/Cargo.toml b/crates/crash-handler/Cargo.toml
index 181fbe26dd34b..c8d61502f3186 100644
--- a/crates/crash-handler/Cargo.toml
+++ b/crates/crash-handler/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "crash-handler"
+name = "aptos-crash-handler"
 description = "Aptos crash handler"
 version = "0.1.0"
 
diff --git a/crates/fallible/Cargo.toml b/crates/fallible/Cargo.toml
index dab35d263bdf2..6563764a437bc 100644
--- a/crates/fallible/Cargo.toml
+++ b/crates/fallible/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "fallible"
+name = "aptos-fallible"
 description = "Fallible utlities for infallible operations"
 version = "0.1.0"
 
diff --git a/developer-docs-site/docs/concepts/blocks.md b/developer-docs-site/docs/concepts/blocks.md
index 9b42a8706264e..2e8181f2320b0 100644
--- a/developer-docs-site/docs/concepts/blocks.md
+++ b/developer-docs-site/docs/concepts/blocks.md
@@ -7,7 +7,7 @@ id: "blocks"
 
 Aptos is a per-transaction versioned database. When transactions are executed, the resulting state of each transaction is stored separately and thus allows for more granular data access. This is different from other blockchains where only the resulting state of a block (a group of transactions) is stored.
 
-Blocks are still a fundamental unit within Aptos. Transactions are batched and executed together in a block. In addition, the [proofs](../concepts/txns-states/#proofs) within storage are at the block-level granularity. The number of transactions within a block varies depending on network activity and a configurable maximum block size limit. As the blockchain becomes busier, blocks will likely contain more transactions.
+Blocks are still a fundamental unit within Aptos. Transactions are batched and executed together in a block. In addition, the [proofs](./txns-states.md#proofs) within storage are at the block-level granularity. The number of transactions within a block varies depending on network activity and a configurable maximum block size limit. As the blockchain becomes busier, blocks will likely contain more transactions.
 
 ## System transactions
 
diff --git a/developer-docs-site/docs/concepts/gas-txn-fee.md b/developer-docs-site/docs/concepts/gas-txn-fee.md
index 9535d83209c4a..bc35d14443dc9 100755
--- a/developer-docs-site/docs/concepts/gas-txn-fee.md
+++ b/developer-docs-site/docs/concepts/gas-txn-fee.md
@@ -17,10 +17,10 @@ Conceptually, this fee can be thought of as quite similar to how we pay for our
  
 ## Unit of gas
 
-Transactions can range from simple and inexpensive to complicated based upon the amount of computation and fetches from and writes to storage. In the Aptos blockchain, a **unit of gas** represents a basic unit of resource consumption for both
+Transactions can range from simple and inexpensive to complicated based upon the amount of computation and fetches from and writes to storage. In the Aptos blockchain, a **unit of gas** represents a basic unit of resource consumption for both:
 
-- Computation resource, and
-- Storage resource.
+- Computation resource
+- Storage resource
 
 See [How Base Gas Works](./base-gas.md) for a detailed description of gas fee types and available optimizations.
 
@@ -28,7 +28,7 @@ See [How Base Gas Works](./base-gas.md) for a detailed description of gas fee ty
 
 In the Aptos network, the Aptos governance sets the minimum gas unit price. However, the market determines the actual minimum gas unit price. See [Ethereum Gas Tracker](https://etherscan.io/gastracker), for example, which shows the market price movements of Ethereum gas price.
 
-By specifying a higher gas unit price than the current market price, you can **increase** the priority level for your transaction on the blockchain by paying. While in most cases, this is unnecessary, if the network is under load, this can ensure that your transaction can be processed more quickly.
+By specifying a higher gas unit price than the current market price, you can **increase** the priority level for your transaction on the blockchain by paying a larger processing fee. While in most cases this is unnecessary, if the network is under load this measure can ensure your transaction is processed more quickly. See the `gas_unit_price` entry under [Estimating the gas units via simulation](#estimating-the-gas-units-via-simulation) for details.
 
 :::tip Unit of gas
 👉 A **unit of gas** is a dimensionless number, expressed as an integer. The total gas units consumed by your transaction depends on the complexity of your transaction. The **gas price**, on the other hand, is expressed in terms of Aptos blockchain’s native coin (Octas). Also see [Transactions and States](/concepts/txns-states) for how a transaction submitted to the Aptos blockchain looks like.
@@ -111,5 +111,5 @@ The simulation steps for finding the correct amount of gas for a transaction are
 6. If you feel the need to prioritize or deprioritize your transaction, adjust the `gas_unit_price` of the transaction. Increase the value for higher priority, and decrease the value for lower priority.
 
 ::: tip
-Prioritization is based upon buckets of `gas_unit_price`. The buckets are defined [here](https://github.com/aptos-labs/aptos-core/blob/30b385bf38d3dc8c4e8ee0ff045bc5d0d2f67a85/config/src/config/mempool_config.rs#L8). The current buckets are `[0, 150, 300, 500, 1000, 3000, 5000, 10000, 100000, 1000000]`. Therefore a `gas_unit_price` of 150 and 299 would be priortized nearly the same.
+Prioritization is based upon buckets of `gas_unit_price`. The buckets are defined in [`mempool_config.rs`](https://github.com/aptos-labs/aptos-core/blob/30b385bf38d3dc8c4e8ee0ff045bc5d0d2f67a85/config/src/config/mempool_config.rs#L8). The current buckets are `[0, 150, 300, 500, 1000, 3000, 5000, 10000, 100000, 1000000]`. Therefore, a `gas_unit_price` of 150 and 299 would be priortized nearly the same.
 :::
diff --git a/developer-docs-site/docs/concepts/governance.md b/developer-docs-site/docs/concepts/governance.md
index 83e18b350b04d..0d29e275cb643 100644
--- a/developer-docs-site/docs/concepts/governance.md
+++ b/developer-docs-site/docs/concepts/governance.md
@@ -27,15 +27,15 @@ sources={{
 />
 
 - The  Aptos community can suggest an Aptos Improvement Proposal (AIP) in [GitHub](https://github.com/aptos-foundation/aip).
-- When appropriate, an on-chain proposal can be created for the AIP via the `AptosGovernance` module. 
-- Voters can then vote on this proposal on-chain via the `AptosGovernance` module. If there is sufficient support for a proposal, then it can be resolved.
-- Governance requires a minimal number of votes to be cast by an expiration threshold. However, if sufficient votes, more than 50% of th total supply, are accumulated prior to that threshold, the proposal can be executed **without waiting for the full voting period**.
+- When appropriate, an on-chain proposal can be created for the AIP via the `aptos_governance` module. 
+- Voters can then vote on this proposal on-chain via the `aptos_governance` module. If there is sufficient support for a proposal, then it can be resolved.
+- Governance requires a minimal number of votes to be cast by an expiration threshold. However, if sufficient votes, more than 50% of the total supply, are accumulated prior to that threshold, the proposal can be executed **without waiting for the full voting period**.
 
 ## Who can propose
 
 - To either propose or vote, you must stake but you are not required to run a validator node. However, we recommend that you be a validator with a stake and be a part of the validator set. 
 - To create a proposal, the proposer's backing stake pool must have the minimum required proposer stake. The proposer's stake must be locked up for at least as long as the proposal's voting period. This is to avoid potential spammy proposals. 
-- Proposers can create a proposal by calling [`AptosGovernance::create_proposal`](https://github.com/aptos-labs/aptos-core/blob/27a255ebc662817944435349afc4ec33ea317e64/aptos-move/framework/aptos-framework/sources/aptos_governance.move#L183).
+- Proposers can create a proposal by calling [`aptos_governance::create_proposal`](https://github.com/aptos-labs/aptos-core/blob/27a255ebc662817944435349afc4ec33ea317e64/aptos-move/framework/aptos-framework/sources/aptos_governance.move#L183).
 
 ## Who can vote
 
@@ -43,5 +43,5 @@ sources={{
 - Voting power is calculated based on the current epoch's active stake of the proposer or voter's backing stake pool. In addition, the stake pool's lockup must be at least as long as the proposal's duration.
 
 :::tip
-Each stake pool can only be used to vote on each proposal exactly once.
+Each stake pool can be used to vote on each proposal exactly only one time.
 :::
diff --git a/developer-docs-site/docs/concepts/resources.md b/developer-docs-site/docs/concepts/resources.md
index 86bec01729a18..45e69da75644c 100644
--- a/developer-docs-site/docs/concepts/resources.md
+++ b/developer-docs-site/docs/concepts/resources.md
@@ -9,10 +9,10 @@ On Aptos, on-chain state is organized into resources and modules. These are then
 
 ## Resources vs Objects
 
-Resources refer to top-level objects that are stored directly with an account on the blockchain. Both resources and object are instances of structs. Objects can be resources but can also be individual units of state that are stored inside a resource. An example here is how the APT coin is stored: CoinStore is the resource that contains the APT coin while the Coin itself is an object:
+Resources refer to top-level objects that are stored directly with an account on the blockchain. Both resources and objects are instances of structs. Objects can be resources but can also be individual units of state that are stored inside a resource. An example here is how the APT coin is stored: CoinStore is the resource that contains the APT coin, while the Coin itself is an object:
 
 ```rust
-/// A holder of a specific coin types and associated event handles.
+/// A holder of a specific coin type and associated event handles.
 /// These are kept in a single resource to ensure locality of data.
 struct CoinStore has key {
     coin: Coin,
@@ -33,7 +33,7 @@ struct CustomCoinBox has key {
 }
 ```
 
-## Resource and Object Definition
+## Define resources and objects
 
 All objects and resources are defined within a module that is stored at an address. For example `0x1234::coin::Coin<0x1234::coin::SomeCoin>` would be represented as:
 
@@ -52,17 +52,17 @@ In this example, `0x1234` is the address, `coin` is the module, `Coin` is a stru
 ## Dual ownership of objects, including resources
 
 Objects (including resources) on Aptos are owned by both:
-1. The account where the object is stored, and
+1. The account where the object is stored.
 2. The module that defines the object.
 
-Creating a new resource and storing it into an account requires both the owning account's signature and the module's code. But modifying and deleting the resource/object requires only the module's code and the owning account's address. The fields of an object also can be read only directly by the module's code, which can be offered as public utilities for other modules.
+Creating a new resource and storing it into an account requires both the owning account's signature and the module's code. But modifying and deleting the resource/object requires only the module's code and the owning account's address, but not its signature. The fields of an object also can be read only directly by the module's code, which can be offered as public utilities for other modules.
 
 This dual-ownership design is one of the bases of state safety in Aptos Move and enables powerful but safe functionalities to be built around resources and objects.
 
 ## Viewing a resource
 
-Resources are stored within specific accounts. Resources can be located by searching within the owners account for the resource at its full query path inclusive of its address and module. Resources can be viewed on the [Aptos Explorer](https://explorer.aptoslabs.com/) by searching for the owning account or be directly fetched from a fullnode's API. See [Interacting with the blockchain](../guides/interacting-with-the-blockchain.md) for more information.
+Resources are stored within specific accounts. Resources can be located by searching within the owner's account for the resource at its full query path inclusive of its address and module. Resources can be viewed on the [Aptos Explorer](https://explorer.aptoslabs.com/) by searching for the owning account or be directly fetched from a fullnode's API. See [Interacting with the blockchain](../guides/interacting-with-the-blockchain.md) for more information.
 
 ## How resources are stored
 
-It's up to the smart contract developers to decide how and where a specific state is stored. For example, events for depositing a token can be stored in the receiver account where the deposit happens or in the account the token module is deployed at. In general, storing data in individual user accounts enables a higher level of execution efficiency as there would be no state read/write conflicts among transactions, and they can be executed in parallel.
+It's up to the smart contract developers to decide how and where a specific state is stored. For example, events for depositing a token can be stored in the receiver account where the deposit happens or in the account where the token module is deployed. In general, storing data in individual user accounts enables a higher level of execution efficiency as there would be no state read/write conflicts among transactions, and they can be executed in parallel.
diff --git a/developer-docs-site/docs/concepts/staking.md b/developer-docs-site/docs/concepts/staking.md
index 858829a2a9b10..2099a80dead09 100644
--- a/developer-docs-site/docs/concepts/staking.md
+++ b/developer-docs-site/docs/concepts/staking.md
@@ -8,18 +8,18 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
 # Staking
 
 :::tip Consensus
-We strongly recommend that you read the consensus section of [Aptos Blockchain Deep Dive](../guides/basics-life-of-txn#consensus) before proceeding further. 
+We strongly recommend that you read the consensus section of [Aptos Blockchain Deep Dive](../guides/basics-life-of-txn.md#consensus) before proceeding further. 
 :::
 
 In a distributed system like blockchain, executing a transaction is distinct from updating the state of the ledger and persisting the results in storage. An agreement, i.e., consensus, must be reached by a quorum of validators on the ordering of transactions and their execution results before these results are persisted in storage and the state of the ledger is updated. 
 
-Anyone can participate in the Aptos consensus process, if they stake sufficient utility coin, i.e., place their utility coin into escrow. To encourage validators to participate in the consensus process, each validator's vote weight is proportional to the amount of validator's stake. In exchange, the validator is rewarded proportionally to the amount staked. Hence, the performance of the Blockchain is aligned with the validator's interest, i.e., rewards.  
+Anyone can participate in the Aptos consensus process, if they stake sufficient utility coin, i.e., place their utility coin into escrow. To encourage validators to participate in the consensus process, each validator's vote weight is proportional to the amount of validator's stake. In exchange, the validator is rewarded proportionally to the amount staked. Hence, the performance of the blockchain is aligned with the validator's interest, i.e., rewards.  
 
 :::note 
-Currently slashing is not implemented.
+Currently, slashing is not implemented.
 :::
 
-The current on-chain data can be found [here](https://mainnet.aptoslabs.com/v1/accounts/0x1/resource/0x1::staking_config::StakingConfig). With the configuration set defined in [staking_config.move](https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/aptos-framework/sources/configs/staking_config.move).
+The current on-chain data can be found in [`staking_config::StakingConfig`](https://mainnet.aptoslabs.com/v1/accounts/0x1/resource/0x1::staking_config::StakingConfig). The configuration set is defined in [`staking_config.move`](https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/aptos-framework/sources/configs/staking_config.move).
 
 The rest of this document presents how staking works on the Aptos blockchain. See [Supporting documentation](#supporting-documentation) at the bottom for related resources.
 
@@ -90,7 +90,7 @@ Throughout the duration of an epoch, the following flow of events occurs several
 
 - A validator leader is selected by a deterministic formula based on the validator reputation determined by validator's performance (including whether the validator has voted in the past or not) and stake. **This leader selection is not done by voting.**
 - The selected leader sends a proposal containing the collected quorum votes of the previous proposal and the leader's proposed order of transactions for the new block. 
-- All the validators from the validator set will vote on the leader's proposal for the new block. Once consensus is reached the block can be finalized. Hence the actual list of votes to achieve consensus is a subset of all the validators in the validator set. This leader validator is rewarded. **Rewards are given only to the leader validators, not to the voter validators.**
+- All the validators from the validator set will vote on the leader's proposal for the new block. Once consensus is reached, the block can be finalized. Hence, the actual list of votes to achieve consensus is a subset of all the validators in the validator set. This leader validator is rewarded. **Rewards are given only to the leader validators, not to the voter validators.**
 - The above flow repeats with the selection of another validator leader and repeating the steps for the next new block. Rewards are given at the end of the epoch. 
 
 ## Validator state and stake state
@@ -121,12 +121,12 @@ sources={{
 />
 
 There are two edge cases to call out:
-1. A validator can be moved from active state directly to the inactive state during an epoch change if their stake drops below the required minimum. This happens during an epoch change.
+1. If a validator's stake drops below the required minimum, that validator can be moved from active state directly to the inactive state during an epoch change. This happens only during an epoch change.
 2. Aptos governance can also directly remove validators from the active set. **Note that governance proposals will always trigger an epoch change.**
 
 ### Stake state
 
-The state of stake has more granularity than that of the validator, additional stake can be added and a portion of stake removed from an active validator.
+The state of stake has more granularity than that of the validator; additional stake can be added and a portion of stake removed from an active validator.
 
 
 
-### Validator Ruleset
+### Validator ruleset
 
 The below ruleset is applicable during the changes of state:
 
-- Voting power can only change (increase or decrease) on epoch boundary.
-- A validator’s consensus key and the validator and validator fullnode network addresses can only change on epoch boundary.
+- Voting power can change (increase or decrease) only on epoch boundary.
+- A validator’s consensus key and the validator and validator fullnode network addresses can change only on epoch boundary.
 - Pending inactive stake cannot be moved into inactive (and thus withdrawable) until before lockup expires.
 - No validators in the active validator set can have their stake below the minimum required stake.
 
diff --git a/developer-docs-site/docs/concepts/txns-states.md b/developer-docs-site/docs/concepts/txns-states.md
index 504d3d83cd305..641424c268a9d 100755
--- a/developer-docs-site/docs/concepts/txns-states.md
+++ b/developer-docs-site/docs/concepts/txns-states.md
@@ -39,7 +39,7 @@ A transaction that is successfully submitted but ultimately discarded may have n
 The submitter can try to increase the gas cost by a trivial amount to help make progress and adjust for whatever may have been causing the discarding of the transaction further downstream.
 
 :::tip Read more
-See [Aptos Blockchain Deep Dive](../guides/basics-life-of-txn) for a comprehensive description of the Aptos transaction lifecycle.
+See [Aptos Blockchain Deep Dive](../guides/basics-life-of-txn.md) for a comprehensive description of the Aptos transaction lifecycle.
 :::
 
 ### Contents of a Transaction
@@ -77,14 +77,14 @@ See the tutorial on [Your First Transaction](../tutorials/first-transaction.md)
 :::
 
 :::note Transaction generation
-The Aptos REST API supports generating BCS encoded transactions from JSON. This is useful for rapid prototyping, but be cautious using it in Mainnet as this places a lot of trust on the fullnode generating the transaction.
+The Aptos REST API supports generating BCS-encoded transactions from JSON. This is useful for rapid prototyping, but be cautious using it in Mainnet as this places a lot of trust on the fullnode generating the transaction.
 :::
 
 ## States
 
 The Aptos blockchain's ledger state, or global state, represents the state of all accounts in the Aptos blockchain. Each validator node in the blockchain must know the latest version of the global state to execute any transaction.
 
-Anyone can submit a transaction to the Aptos blockchain to modify the ledger state. Upon execution of a transaction, a transaction output is generated. A transaction output contains zero or more operations to manipulate the ledger state, called **write sets**: a vector of resulting events, the amount of gas consumed, and the executed transaction status.
+Anyone can submit a transaction to the Aptos blockchain to modify the ledger state. Upon execution of a transaction, a transaction output is generated. A transaction output contains zero or more operations to manipulate the ledger state called **write sets** emitting a vector of resulting events, the amount of gas consumed, and the executed transaction status.
 
 ### Proofs
 
diff --git a/developer-docs-site/docs/guides/aptos-apis.md b/developer-docs-site/docs/guides/aptos-apis.md
index e88afc5bc3000..8991e6e497071 100644
--- a/developer-docs-site/docs/guides/aptos-apis.md
+++ b/developer-docs-site/docs/guides/aptos-apis.md
@@ -5,10 +5,10 @@ slug: "aptos-api"
 
 # Use the Aptos REST Read API
 
-If you provide blockchain services to your customers and wish to add the Aptos blockchain to your platform, then this guide is for you. This guide will walk you through all you need to integrate the Aptos blockchain into your platform.
+If you provide blockchain services to your customers and wish to employ the Aptos API, then this guide is for you. This guide will walk you through all you need to integrate the Aptos blockchain into your platform with the Aptos API.
 
 :::tip
-Before starting in this guide, it might be beneficial to read the [System Integrators Guide](/guides/system-integrators-guide).
+Also see the [System Integrators Guide](./system-integrators-guide.md) for a thorough walkthrough of Aptos integration.
 :::
 
 ## Viewing current and historical state
@@ -17,7 +17,7 @@ Most integrations into the Aptos blockchain benefit from a holistic and comprehe
 
 * Historical transactions specify the execution status, output, and tie to related events. Each transaction has a unique version number associated with it that dictates its global sequential ordering in the history of the blockchain ledger.
 * The state is the representation of all transaction outputs up to a specific version. In other words, a state version is the accumulation of all transactions inclusive of that transaction version.
-* As transactions execute, they may emit events. [Events](/concepts/events) are hints about changes in on-chain data.
+* As transactions execute, they may emit events. [Events](../concepts/events.md) are hints about changes in on-chain data.
 
 The storage service on a node employs two forms of pruning that erase data from nodes: 
 
@@ -26,7 +26,7 @@ The storage service on a node employs two forms of pruning that erase data from
 
 While either of these may be disabled, storing the state versions is not particularly sustainable. 
 
-Events and transactions pruning can be disabled via setting the [`enable_ledger_pruner`](https://github.com/aptos-labs/aptos-core/blob/cf0bc2e4031a843cdc0c04e70b3f7cd92666afcf/config/src/config/storage_config.rs#L141) to `false`. This is default behavior in Mainnet. In the near future, Aptos will provide indexers that mitigate the need to directly query from a node.
+Events and transactions pruning can be disabled via setting the [`enable_ledger_pruner`](https://github.com/aptos-labs/aptos-core/blob/cf0bc2e4031a843cdc0c04e70b3f7cd92666afcf/config/src/config/storage_config.rs#L141) to `false` in `storage_config.rs`. This is default behavior in Mainnet. In the near future, Aptos will provide indexers that mitigate the need to directly query from a node.
 
 The REST API offers querying transactions and events in these ways:
 
@@ -36,7 +36,7 @@ The REST API offers querying transactions and events in these ways:
 
 ## Exchanging and tracking coins
 
-Aptos has a standard [Coin type](https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/aptos-framework/sources/coin.move). Different types of coins can be represented in this type through the use of distinct structs that represent the type parameter or generic for `Coin`. 
+Aptos has a standard *Coin type* define in [`coin.move`](https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/aptos-framework/sources/coin.move). Different types of coins can be represented in this type through the use of distinct structs that symbolize the type parameter or use generic for `Coin`. 
 
 Coins are stored within an account under the resource `CoinStore`. At account creation, each user has the resource `CoinStore<0x1::aptos_coin::AptosCoin>` or `CoinStore`, for short. Within this resource is the Aptos coin: `Coin`.
 
@@ -197,7 +197,7 @@ The `key` field will be going away in favor of `guid`
 
 ### Querying events
 
-Aptos provides clear and canonical events for all withdraw and deposit of coins. This can be used in coordination with the associated transactions to present to a user the change of their account balance over time, when that happened, and what caused it. With some amount of additional parsing, metadata such as the transaction type and the other parties involved can also be shared.
+Aptos provides clear and canonical events for all withdraw and deposit of coins. This can be used in coordination with the associated transactions to present to a user the change of their account balance over time, when that happened, and what caused it. With some amount of additional parsing, you can share metadata such as the transaction type and the other parties involved.
 
 Query events by handle URL: `https://{rest_api_server}/accounts/{address}/events/0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>/withdraw_events`
 
@@ -329,7 +329,7 @@ To retrieve the withdrawal information:
 4. Note the `amount` field will be the number of `CoinType` removed from the account in the `guid`. In this example, it is `1000`.
 
 To retrieve the deposit information, it's the same as withdrawal except:
-1. The `guid` used is under `deposit_events`
+1. The `guid` used is under: `deposit_events`
 2. The `amount` will be a positive increase on the account's balance.
 3. The event's name will be: `0x1::coin::DepositEvent`
 
@@ -353,6 +353,6 @@ By monitoring the events, you will find all balance changes in the `0x1::coin::C
 
 :::
 
-To create some sample data to explore, conduct ["Your first transaction"](../tutorials/your-first-transaction).
+To create some sample data to explore, conduct ["Your first transaction"](../tutorials/your-first-transaction.md).
 
-To learn more about coin creation, make ["Your First Coin"](../tutorials/your-first-coin).
+To learn more about coin creation, make ["Your First Coin"](../tutorials/your-first-coin.md).
diff --git a/developer-docs-site/docs/guides/basics-life-of-txn.md b/developer-docs-site/docs/guides/basics-life-of-txn.md
index 31afa223a8151..82ef08208cc14 100755
--- a/developer-docs-site/docs/guides/basics-life-of-txn.md
+++ b/developer-docs-site/docs/guides/basics-life-of-txn.md
@@ -12,10 +12,10 @@ For a deeper understanding of the lifecycle of an Aptos transaction (from an ope
 
 ## Life of a Transaction
 
-* Alice and Bob are two users who each have an [account](/reference/glossary#account) on the Aptos blockchain.
+* Alice and Bob are two users who each have an [account](../reference/glossary.md#account) on the Aptos blockchain.
 * Alice's account has 110 Aptos Coins.
 * Alice is sending 10 Aptos Coins to Bob.
-* The current [sequence number](/reference/glossary#sequence-number) of Alice's account is 5 (which indicates that 5 transactions have already been sent from Alice's account).
+* The current [sequence number](../reference/glossary.md#sequence-number) of Alice's account is 5 (which indicates that 5 transactions have already been sent from Alice's account).
 * There are a total of 100 validator nodes — V1 to V100 on the network.
 * An Aptos client submits Alice's transaction to a REST service on an Aptos Fullnode. The fullnode forwards this transaction to a validator fullnode which in turn forwards it to validator V1.
 * Validator V1 is a proposer/leader for the current round.
@@ -62,12 +62,12 @@ The raw transaction includes the following fields:
 
 | Fields | Description |
 | ------ | ----------- |
-| [Account address](/reference/glossary#account-address) | Alice's account address |
-| Move module | A module (or program) that indicates the actions to be performed on Alice's behalf. In this case, it contains:  
- A Move bytecode peer-to-peer [transaction script](/reference/glossary#transaction-script)
- A list of inputs to the script (for this example the list would contain Bob's account address and the payment amount in Aptos Coins). | -| [Maximum gas amount](/reference/glossary#maximum-gas-amount) | The maximum gas amount Alice is willing to pay for this transaction. Gas is a way to pay for computation and storage. A gas unit is an abstract measurement of computation. | -| [Gas price](/reference/glossary#gas-price) | The amount (in Aptos Coins) Alice is willing to pay per unit of gas, to execute the transaction. | -| [Expiration time](/reference/glossary#expiration-time) | Expiration time of the transaction. | -| [Sequence number](/reference/glossary#sequence-number) | The sequence number (5, in this example) for an account indicates the number of transactions that have been submitted and committed on-chain from that account. In this case, 5 transactions have been submitted from Alice’s account, including Traw5. Note: a transaction with sequence number 5 can only be committed on-chain if the account sequence number is 5. | +| [Account address](../reference/glossary.md#account-address) | Alice's account address | +| Move module | A module (or program) that indicates the actions to be performed on Alice's behalf. In this case, it contains:
- A Move bytecode peer-to-peer [transaction script](../reference/glossary.md#transaction-script)
- A list of inputs to the script (for this example the list would contain Bob's account address and the payment amount in Aptos Coins). | +| [Maximum gas amount](../reference/glossary.md#maximum-gas-amount) | The maximum gas amount Alice is willing to pay for this transaction. Gas is a way to pay for computation and storage. A gas unit is an abstract measurement of computation. | +| [Gas price](../reference/glossary.md#gas-price) | The amount (in Aptos Coins) Alice is willing to pay per unit of gas, to execute the transaction. | +| [Expiration time](../reference/glossary.md#expiration-time) | Expiration time of the transaction. | +| [Sequence number](../reference/glossary.md#sequence-number) | The sequence number (5, in this example) for an account indicates the number of transactions that have been submitted and committed on-chain from that account. In this case, 5 transactions have been submitted from Alice’s account, including Traw5. Note: a transaction with sequence number 5 can only be committed on-chain if the account sequence number is 5. | | [Chain ID](https://github.com/aptos-labs/aptos-core/blob/main/types/src/chain_id.rs) | An identifier that distinguishes the Aptos network deployments (to prevent cross-network attacks). | ### Accepting the transaction @@ -112,7 +112,7 @@ Alice's account will now have 100 Aptos Coins, and its sequence number will be 6 ## Aptos node component interactions -In the [previous section](#life-of-a-transaction), we described the typical lifecycle of a transaction (from transaction submission to transaction commit). Now let's look at the inter-component interactions of Aptos nodes as the blockchain processes transactions and responds to queries. This information will be most useful to those who: +In the [Life of a Transaction](#life-of-a-transaction) section, we described the typical lifecycle of a transaction (from transaction submission to transaction commit). Now let's look at the inter-component interactions of Aptos nodes as the blockchain processes transactions and responds to queries. This information will be most useful to those who: * Would like to get an idea of how the system works under the covers. * Are interested in eventually contributing to the Aptos blockchain. diff --git a/developer-docs-site/docs/guides/resource-accounts.md b/developer-docs-site/docs/guides/resource-accounts.md index 722882f69a809..3187acecad42a 100644 --- a/developer-docs-site/docs/guides/resource-accounts.md +++ b/developer-docs-site/docs/guides/resource-accounts.md @@ -14,18 +14,23 @@ Typically, a resource account is used for two main purposes: ## Restrictions -In Aptos, a resource account is created based upon the SHA3-256 hash of the source's address and additional seed data. A resource account can be created only once. An entity may call `create_account` in an attempt to claim an account ahead of the creation of a resource account. But if a resource account is found, Aptos will transition ownership of the account over to the resource account. This is done by validating that the account has yet to execute any transactions and that the `Account::signer_capbility_offer::for` is none. The probability of a collision where someone has legitimately produced a private key that maps to a resource account address is improbably low. +In Aptos, a resource account is created based upon the SHA3-256 hash of the source's address and additional seed data. A resource account can be created only once; for a given source address and seed, there can be only one resource account. That is because the calculation of the resource account address is fully determined by the former. + +An entity may call `create_account` in an attempt to claim an account ahead of the creation of a resource account. But if a resource account is found, Aptos will transition ownership of the account over to the resource account. This is done by validating that the account has yet to execute any transactions and that the `Account::signer_capbility_offer::for` is none. The probability of a collision where someone has legitimately produced a private key that maps to a resource account address is improbably low. ## Setup -To properly set a resource account up, you will need to [initialize](https://github.com/aptos-labs/aptos-core/blob/2e9d8ee759fcd3f6e831034f05c1656b1c48efc4/aptos-move/move-examples/mint_nft/sources/minting.move#L73) the `mint_nft` module and retrieve the signer capability from both the resource account and module account. To do so, call `create_resource_account_and_publish_package` to publish the module under the resource account's address. +The easiest way to set up a resource account is by: -You have three options for creating a resource account: -* `create_resource_account_and_publish_package` - creates the resource account and results in loss of access to the resource account by design, because resource accounts are used to make contracts autonomous and immutable. -* `create_resource_account_and_fund` - creates the resource account and funds it, retaining access to the resource account's signer until explicitly calling `retrieve_resource_account_cap`. +1. Using Aptos CLI: `aptos account create-resource-account` creates a resource account, and `aptos move create-resource-account-and-publish-package` creates a resource account and publishes the specified package under the resource account's adddress. +1. Writing custom smart contracts code: in the `resource_account.move` module, developers can find the resource account creation functions `create_resource_account`, `create_resource_account_and_fund`, and `create_resource_account_and_publish_package`. Developers can then call those functions to create resource accounts in their smart contracts. + +Each of those options offers slightly different functionality: * `create_resource_account` - merely creates the resource account but doesn't fund it, retaining access to the resource account's signer until explicitly calling `retrieve_resource_account_cap`. +* `create_resource_account_and_fund` - creates the resource account and funds it, retaining access to the resource account's signer until explicitly calling `retrieve_resource_account_cap`. +* `create_resource_account_and_publish_package` - creates the resource account and results in loss of access to the resource account by design, because resource accounts are used to make contracts autonomous and immutable. -Follow these steps and examples, which assume use of `create_resource_account_and_publish_package`: +In this example, you will [initialize](https://github.com/aptos-labs/aptos-core/blob/2e9d8ee759fcd3f6e831034f05c1656b1c48efc4/aptos-move/move-examples/mint_nft/sources/minting.move#L73) the `mint_nft` module and retrieve the signer capability from both the resource account and module account. To do so, call `create_resource_account_and_publish_package` to publish the module under the resource account's address. 1. Initialize the module as shown in the [`minting.move`](https://github.com/aptos-labs/aptos-core/blob/2e9d8ee759fcd3f6e831034f05c1656b1c48efc4/aptos-move/move-examples/mint_nft/sources/minting.move#L73) example. 1. Call `create_resource_account_and_publish_package` to publish the module under the resource account's address, such as in the [`mint_nft.rs`](https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/e2e-move-tests/src/tests/mint_nft.rs#L62) end-to-end example. diff --git a/developer-docs-site/docs/guides/running-a-local-multi-node-network.md b/developer-docs-site/docs/guides/running-a-local-multi-node-network.md index d3c6b5a26e9e6..aac73a6732b67 100644 --- a/developer-docs-site/docs/guides/running-a-local-multi-node-network.md +++ b/developer-docs-site/docs/guides/running-a-local-multi-node-network.md @@ -48,7 +48,7 @@ With your development environment ready, now you can proceed below. To deploy multiple local validators, run: ```bash -cargo run -p forge-cli \ +cargo run -p aptos-forge-cli \ -- \ --suite "run_forever" \ --num-validators 4 test local-swarm @@ -110,7 +110,7 @@ Also see how to use the [Aptos CLI](https://aptos.dev/cli-tools/aptos-cli-tool/u To also run validator fullnodes inside the network, use the `--num-validator-fullnodes` flag. For example: ```bash -cargo run -p forge-cli \ +cargo run -p aptos-forge-cli \ -- \ --suite "run_forever" \ --num-validators 3 \ @@ -121,5 +121,5 @@ cargo run -p forge-cli \ To see all tool usage options, run: ```bash -cargo run -p forge-cli --help -``` \ No newline at end of file +cargo run -p aptos-forge-cli --help +``` diff --git a/developer-docs-site/docs/guides/system-integrators-guide.md b/developer-docs-site/docs/guides/system-integrators-guide.md index 19d60da8ff900..fe1b8fe37c5f5 100644 --- a/developer-docs-site/docs/guides/system-integrators-guide.md +++ b/developer-docs-site/docs/guides/system-integrators-guide.md @@ -26,24 +26,24 @@ This document will guide you through the following tasks to integrate with Aptos In order to get started you'll need to select a network and pick your set of tools. There are also a handful of SDKs to help accelerate development. -### Choosing a network +### Choose a network There are four well-supported networks for integrating with the Aptos blockchain: -1. Local testnet -- our standalone tool for local development against a known version of the codebase with no external network. -1. Devnet -- a shared resource for the community, data resets weekly, weekly update from aptos-core main branch. -1. Testnet -- a shared resource for the community, data will be preserved, network configuration will mimic Mainnet. -1. Mainnet -- a production network with real assets. +1. [Local testnet](http://127.0.0.1:8080) -- our standalone tool for local development against a known version of the codebase with no external network. +1. [Devnet](https://fullnode.devnet.aptoslabs.com/v1/spec#/) -- a shared resource for the community, data resets weekly, weekly update from aptos-core main branch. +1. [Testnet](https://fullnode.testnet.aptoslabs.com/v1/spec#/) -- a shared resource for the community, data will be preserved, network configuration will mimic Mainnet. +1. [Mainnet](https://fullnode.mainnet.aptoslabs.com/v1/spec#/) -- a production network with real assets. See [Aptos Blockchain Deployments](../nodes/aptos-deployments.md) for full details on each environment. -### Running a Local Testnet +### Run a local testnet There are two options for running a local testnet: -* Directly [run a local testnet](../nodes/local-testnet/run-a-local-testnet.md) using either the [Aptos-core source code](/nodes/local-testnet/run-a-local-testnet/#using-the-aptos-core-source-code) or a [Docker image](/nodes/local-testnet/run-a-local-testnet/#using-docker). These paths are useful for testing changes to the Aptos-core codebase or framework, or for building services on top of the Aptos blockchain, respectively. -* [Install the Aptos CLI](/cli-tools/aptos-cli-tool/install-aptos-cli) and 2) start a [local node with a faucet](/nodes/local-testnet/using-cli-to-run-a-local-testnet#starting-a-local-testnet-with-a-faucet). This path is useful for developing on the Aptos blockchain, debugging Move contracts, and testing node operations. +* Directly [run a local testnet](../nodes/local-testnet/run-a-local-testnet.md) using either the [Aptos-core source code](../nodes/local-testnet/run-a-local-testnet.md#using-the-aptos-core-source-code) or a [Docker image](../nodes/local-testnet/run-a-local-testnet.md#using-docker). These paths are useful for testing changes to the Aptos-core codebase or framework, or for building services on top of the Aptos blockchain, respectively. +* [Install the Aptos CLI](../cli-tools/aptos-cli-tool/install-aptos-cli.md) and 2) start a [local node with a faucet](../nodes/local-testnet/using-cli-to-run-a-local-testnet.md#starting-a-local-testnet-with-a-faucet). This path is useful for developing on the Aptos blockchain, debugging Move contracts, and testing node operations. -Either of these methods will expose a REST API service at `http://127.0.0.1:8080` and a Faucet API service at `http://127.0.0.1:8000` for option 1 or `http://127.0.0.1:8081` for option 2. The applications will output the location of the services. +Either of these methods will expose a REST API service at `http://127.0.0.1:8080` and a Faucet API service at `http://127.0.0.1:8000` for option 1 run a local testnet or `http://127.0.0.1:8081` for option 2 install the Aptos CLI. The applications will output the location of the services. ### Production network access @@ -77,43 +77,43 @@ Either of these methods will expose a REST API service at `http://127.0.0.1:8080 -### SDKs and Tools +### SDKs and tools Aptos currently provides three SDKs: -1. [Typescript](/sdks/ts-sdk/index) -2. [Python](/sdks/python-sdk) -3. [Rust](/sdks/rust-sdk) +1. [Typescript](../sdks/ts-sdk/index.md) +2. [Python](../sdks/python-sdk.md) +3. [Rust](../sdks/rust-sSDKs and Toolsdk.md) -Almost all developers will benefit from exploring the CLI. [Using the CLI](../cli-tools/aptos-cli-tool/use-aptos-cli) demonstrates how the CLI can be used to which includes creating accounts, transferring coins, and publishing modules. +Almost all developers will benefit from exploring the CLI. [Using the CLI](../cli-tools/aptos-cli-tool/use-aptos-cli.md) demonstrates how the CLI can be used to which includes creating accounts, transferring coins, and publishing modules. ## Accounts on Aptos -An [account](/concepts/accounts) represents an entity on the Aptos blockchain that can send transactions. Each account is identified by a particular 32-byte account address and is a container for [Move modules and resources](/concepts/resources). On Aptos, accounts must be created on-chain prior to any blockchain operations involving that account. The Aptos framework supports implicitly creating accounts when transferring Aptos coin via [`aptos_account::transfer`](https://github.com/aptos-labs/aptos-core/blob/88c9aab3982c246f8aa75eb2caf8c8ab1dcab491/aptos-move/framework/aptos-framework/sources/aptos_account.move#L18) or explicitly via [`aptos_account::create_account`](https://github.com/aptos-labs/aptos-core/blob/88c9aab3982c246f8aa75eb2caf8c8ab1dcab491/aptos-move/framework/aptos-framework/sources/aptos_account.move#L13). +An [account](../concepts/accounts.md) represents an entity on the Aptos blockchain that can send transactions. Each account is identified by a particular 32-byte account address and is a container for [Move modules and resources](../concepts/resources.md). On Aptos, accounts must be created on-chain prior to any blockchain operations involving that account. The Aptos framework supports implicitly creating accounts when transferring Aptos coin via [`aptos_account::transfer`](https://github.com/aptos-labs/aptos-core/blob/88c9aab3982c246f8aa75eb2caf8c8ab1dcab491/aptos-move/framework/aptos-framework/sources/aptos_account.move#L18) or explicitly via [`aptos_account::create_account`](https://github.com/aptos-labs/aptos-core/blob/88c9aab3982c246f8aa75eb2caf8c8ab1dcab491/aptos-move/framework/aptos-framework/sources/aptos_account.move#L13). At creation, an [Aptos account](https://github.com/aptos-labs/aptos-core/blob/88c9aab3982c246f8aa75eb2caf8c8ab1dcab491/aptos-move/framework/aptos-framework/sources/account.move#L23) contains: * A [resource containing Aptos Coin](https://github.com/aptos-labs/aptos-core/blob/60751b5ed44984178c7163933da3d1b18ad80388/aptos-move/framework/aptos-framework/sources/coin.move#L50) and deposit and withdrawal of coins from that resource. * An authentication key associated with their current public, private key(s). -* A strictly increasing [sequence number](/concepts/accounts#account-sequence-number) that represents the account's next transaction's sequence number to prevent replay attacks. +* A strictly increasing [sequence number](../concepts/accounts.md#account-sequence-number) that represents the account's next transaction's sequence number to prevent replay attacks. * A strictly increasing number that represents the next distinct GUID creation number. -* An [event handle](/concepts/events) for all new types of coins added to the account. +* An [event handle](../concepts/events.md) for all new types of coins added to the account. * An event handle for all key rotations for the account. -Read more in [Accounts](/concepts/accounts). +Read more in [Accounts](../concepts/accounts.md). ## Transactions -Aptos [transactions](/concepts/txns-states) are encoded in [Binary Canonical Serialization (BCS)](https://github.com/diem/bcs). Transactions contain information such as the sender’s account address, authentication from the sender, the desired operation to be performed on the Aptos blockchain, and the amount of gas the sender is willing to pay to execute the transaction. +Aptos [transactions](../concepts/txns-states.md) are encoded in [Binary Canonical Serialization (BCS)](https://github.com/diem/bcs). Transactions contain information such as the sender’s account address, authentication from the sender, the desired operation to be performed on the Aptos blockchain, and the amount of gas the sender is willing to pay to execute the transaction. -Read more in [Transactions and States](/concepts/txns-states). +Read more in [Transactions and States](../concepts/txns-states.md). -### Generating Transactions +### Generating transactions Aptos supports two methods for constructing transactions: -- Using the Aptos client libraries to generate native bcs transactions. +- Using the Aptos client libraries to generate native BCS transactions. - Constructing JSON-encoded objects and interacting with the REST API to generate native transactions. -The preferred approach is to directly generate native bcs transactions. Generating them via the REST API enables rapid development at the cost of trusting the fullnode to generate the transaction correctly. +The preferred approach is to directly generate native BCS transactions. Generating them via the REST API enables rapid development at the cost of trusting the fullnode to generate the transaction correctly. #### BCS-encoded transactions @@ -136,9 +136,9 @@ Within a given transaction, the target of execution can be one of two types: - An entry point (formerly known as script function) - A script (payload) -Both [Python](https://github.com/aptos-labs/aptos-core/blob/3973311dac6bb9348bfc81cf983c2a1be11f1b48/ecosystem/python/sdk/aptos_sdk/client.py#L256) and [Typescript](https://github.com/aptos-labs/aptos-core/blob/3973311dac6bb9348bfc81cf983c2a1be11f1b48/ecosystem/typescript/sdk/src/aptos_client.test.ts#L93) support the generation of transactions that target entry points. This guide points out many of those entry points, such as `aptos_account::transfer` and `aptos_account::create_account`. +Both [Python](https://github.com/aptos-labs/aptos-core/blob/3973311dac6bb9348bfc81cf983c2a1be11f1b48/ecosystem/python/sdk/aptos_sdk/client.py#L256) and [TypeScript](https://github.com/aptos-labs/aptos-core/blob/3973311dac6bb9348bfc81cf983c2a1be11f1b48/ecosystem/typescript/sdk/src/aptos_client.test.ts#L93) support the generation of transactions that target entry points. This guide points out many of those entry points, such as `aptos_account::transfer` and `aptos_account::create_account`. -Most basic operations on the Aptos blockchain should be available via entry point calls. While one could submit multiple transactions calling entry points in series, such operations benefit from being called atomically from a single transaction. A script payload transaction can call any public (entry) function defined within any module. Here's an example [Move script](https://github.com/aptos-labs/aptos-core/tree/main/aptos-move/move-examples/scripts/two_by_two_transfer) that uses a MultiAgent transaction to extract funds from two accounts and deposit them into two other accounts. This is a [Python example](https://github.com/aptos-labs/aptos-core/blob/main/ecosystem/python/sdk/examples/transfer-two-by-two.py) that uses the bytecode generated by compiling that script. Currently there is limited support for script payloads in Typescript. +Most basic operations on the Aptos blockchain should be available via entry point calls. While one could submit multiple transactions calling entry points in series, such operations benefit from being called atomically from a single transaction. A script payload transaction can call any public (entry) function defined within any module. Here's an example [Move script](https://github.com/aptos-labs/aptos-core/tree/main/aptos-move/move-examples/scripts/two_by_two_transfer) that uses a MultiAgent transaction to extract funds from two accounts and deposit them into two other accounts. This is a [Python example](https://github.com/aptos-labs/aptos-core/blob/main/ecosystem/python/sdk/examples/transfer-two-by-two.py) that uses the bytecode generated by compiling that script. Currently there is limited support for script payloads in TypeScript. ### Status of a transaction @@ -160,7 +160,7 @@ Most integrations into the Aptos blockchain benefit from a holistic and comprehe * Historical transactions specify the execution status, output, and tie to related events. Each transaction has a unique version number associated with it that dictates its global sequential ordering in the history of the blockchain ledger. * The state is the representation of all transaction outputs up to a specific version. In other words, a state version is the accumulation of all transactions inclusive of that transaction version. -* As transactions execute, they may emit events. [Events](/concepts/events) are hints about changes in on-chain data. +* As transactions execute, they may emit events. [Events](../concepts/events.md) are hints about changes in on-chain data. The storage service on a node employs two forms of pruning that erase data from nodes: diff --git a/developer-docs-site/docs/whats-new-in-docs.md b/developer-docs-site/docs/whats-new-in-docs.md index 718034428b3ab..12763196038ee 100644 --- a/developer-docs-site/docs/whats-new-in-docs.md +++ b/developer-docs-site/docs/whats-new-in-docs.md @@ -7,6 +7,10 @@ slug: "whats-new-in-docs" This page shows the key updates to the developer documentation on this site. +## 02 December 2022 + +- Distributed a survey asking how we can make the Aptos developer experience better: https://aptos.typeform.com/dev-survey + ## 29 November 2022 - Increased rate limits of https://indexer.mainnet.aptoslabs.com and https://fullnode.mainnet.aptoslabs.com to 1000 requests/5-minute interval by IP. diff --git a/developer-docs-site/scripts/additional_dict.txt b/developer-docs-site/scripts/additional_dict.txt index 7df860eff63a2..efe33d6f7225f 100644 --- a/developer-docs-site/scripts/additional_dict.txt +++ b/developer-docs-site/scripts/additional_dict.txt @@ -164,6 +164,7 @@ STM SYNACK Scalable SeaLevel +SHA SignMessagePayload SignerCap Skylake diff --git a/developer-docs-site/sidebars.js b/developer-docs-site/sidebars.js index d8bb5e693c053..4529716660411 100644 --- a/developer-docs-site/sidebars.js +++ b/developer-docs-site/sidebars.js @@ -81,7 +81,7 @@ const sidebars = { link: { type: "doc", id: "concepts/coin-and-token/index" }, collapsible: true, collapsed: true, - items: ["concepts/coin-and-token/aptos-coin", "concepts/coin-and-token/aptos-token"], + items: ["concepts/coin-and-token/aptos-coin", "concepts/coin-and-token/aptos-token", "guides/wallet-standard"], }, { type: "category", @@ -96,12 +96,7 @@ const sidebars = { link: { type: "doc", id: "guides/index" }, collapsible: true, collapsed: true, - items: [ - "guides/sign-a-transaction", - "guides/resource-accounts", - "guides/wallet-standard", - "guides/handle-aptos-errors", - ], + items: ["guides/sign-a-transaction", "guides/resource-accounts", "guides/handle-aptos-errors"], }, { type: "category", @@ -274,13 +269,8 @@ const sidebars = { value: "Reference", className: "sidebar-title", }, - { - type: "category", - label: "Aptos API", - collapsible: true, - collapsed: true, - items: ["nodes/aptos-api-spec", "reference/index"], - }, + "reference/index", + "nodes/aptos-api-spec", { type: "category", label: "Aptos SDKs", diff --git a/docker/build-rust-all.sh b/docker/build-rust-all.sh index f5bf2773d481e..f64e0e0dc9564 100755 --- a/docker/build-rust-all.sh +++ b/docker/build-rust-all.sh @@ -15,12 +15,12 @@ cargo build --locked --profile=$PROFILE \ -p aptos \ -p aptos-backup-cli \ -p aptos-faucet \ + -p aptos-forge-cli \ -p aptos-fn-check-client \ -p aptos-node-checker \ -p aptos-openapi-spec-generator \ -p aptos-telemetry-service \ -p db-bootstrapper \ - -p forge-cli \ -p transaction-emitter \ "$@" @@ -59,4 +59,4 @@ for BIN in "${BINS[@]}"; do done # Build the Aptos Move framework and place it in dist. It can be found afterwards in the current directory. -(cd dist && cargo run --package framework -- release) +(cd dist && cargo run --package aptos-framework -- release) diff --git a/ecosystem/node-checker/fn-check-client/README.md b/ecosystem/node-checker/fn-check-client/README.md index 403777eb04889..5c9ab91c6e73e 100644 --- a/ecosystem/node-checker/fn-check-client/README.md +++ b/ecosystem/node-checker/fn-check-client/README.md @@ -12,7 +12,7 @@ The original intent behind this tool is to confirm operators are running quality ## Local development Run a local network with both a validator and VFNs: ``` -cargo run -p forge-cli -- --suite "run_forever" --num-validators 4 --num-validator-fullnodes 2 --mempool-backlog 5000 test local-swarm +cargo run -p aptos-forge-cli -- --suite "run_forever" --num-validators 4 --num-validator-fullnodes 2 --mempool-backlog 5000 test local-swarm ``` Run local NHC: diff --git a/execution/db-bootstrapper/Cargo.toml b/execution/db-bootstrapper/Cargo.toml index 335c3a182a2fe..465b27e14bd5d 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-executor = { workspace = true } aptos-temppath = { workspace = true } aptos-types = { workspace = true } aptos-vm = { workspace = true } aptosdb = { workspace = true } bcs = { workspace = true } -executor = { workspace = true } storage-interface = { 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 eadc83fb6b339..2584fa9c0c471 100644 --- a/execution/db-bootstrapper/src/bin/db-bootstrapper.rs +++ b/execution/db-bootstrapper/src/bin/db-bootstrapper.rs @@ -6,10 +6,10 @@ use aptos_config::config::{ RocksdbConfigs, BUFFERED_STATE_TARGET_ITEMS, DEFAULT_MAX_NUM_NODES_PER_LRU_CACHE_SHARD, NO_OP_STORAGE_PRUNER_CONFIG, }; +use aptos_executor::db_bootstrapper::calculate_genesis; use aptos_types::{transaction::Transaction, waypoint::Waypoint}; use aptos_vm::AptosVM; use aptosdb::AptosDB; -use executor::db_bootstrapper::calculate_genesis; use std::{ fs::File, io::Read, diff --git a/execution/executor-benchmark/Cargo.toml b/execution/executor-benchmark/Cargo.toml index 42edf9ffffc0f..1c1e262622e9d 100644 --- a/execution/executor-benchmark/Cargo.toml +++ b/execution/executor-benchmark/Cargo.toml @@ -15,6 +15,8 @@ rust-version = { workspace = true } [dependencies] aptos-config = { workspace = true } aptos-crypto = { workspace = true } +aptos-executor = { workspace = true } +aptos-executor-types = { workspace = true } aptos-genesis = { workspace = true, features = ["testing"] } aptos-infallible = { workspace = true } aptos-jellyfish-merkle = { workspace = true } @@ -27,8 +29,6 @@ aptos-vm = { workspace = true } aptosdb = { workspace = true } chrono = { workspace = true } criterion = { workspace = true } -executor = { workspace = true } -executor-types = { workspace = true } indicatif = { workspace = true } itertools = { workspace = true } num_cpus = { workspace = true } diff --git a/execution/executor-benchmark/benches/executor_benchmark.rs b/execution/executor-benchmark/benches/executor_benchmark.rs index 0150b06cf5686..65e7cd576d964 100644 --- a/execution/executor-benchmark/benches/executor_benchmark.rs +++ b/execution/executor-benchmark/benches/executor_benchmark.rs @@ -1,12 +1,12 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 +use aptos_executor_types::BlockExecutorTrait; use criterion::{criterion_group, criterion_main, measurement::Measurement, BatchSize, Criterion}; use executor_benchmark::{ init_db_and_executor, transaction_executor::TransactionExecutor, transaction_generator::TransactionGenerator, }; -use executor_types::BlockExecutorTrait; use std::sync::Arc; pub const NUM_ACCOUNTS: usize = 1000; diff --git a/execution/executor-benchmark/src/db_generator.rs b/execution/executor-benchmark/src/db_generator.rs index 66f82c6958249..745974ce4141e 100644 --- a/execution/executor-benchmark/src/db_generator.rs +++ b/execution/executor-benchmark/src/db_generator.rs @@ -10,9 +10,9 @@ use aptos_config::{ use aptos_config::config::{ PrunerConfig, BUFFERED_STATE_TARGET_ITEMS, DEFAULT_MAX_NUM_NODES_PER_LRU_CACHE_SHARD, }; +use aptos_executor::db_bootstrapper::{generate_waypoint, maybe_bootstrap}; use aptos_vm::AptosVM; use aptosdb::AptosDB; -use executor::db_bootstrapper::{generate_waypoint, maybe_bootstrap}; use std::{fs, path::Path}; use storage_interface::DbReaderWriter; diff --git a/execution/executor-benchmark/src/lib.rs b/execution/executor-benchmark/src/lib.rs index 434d19442a4fb..6a0776e7aee86 100644 --- a/execution/executor-benchmark/src/lib.rs +++ b/execution/executor-benchmark/src/lib.rs @@ -22,8 +22,8 @@ use aptos_jellyfish_merkle::metrics::{ use aptosdb::AptosDB; use crate::pipeline::Pipeline; +use aptos_executor::block_executor::BlockExecutor; use aptos_vm::AptosVM; -use executor::block_executor::BlockExecutor; use std::{fs, path::Path}; use storage_interface::DbReaderWriter; diff --git a/execution/executor-benchmark/src/pipeline.rs b/execution/executor-benchmark/src/pipeline.rs index c445ea390e7ea..2477c736b6078 100644 --- a/execution/executor-benchmark/src/pipeline.rs +++ b/execution/executor-benchmark/src/pipeline.rs @@ -2,11 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 use crate::{TransactionCommitter, TransactionExecutor}; +use aptos_executor::block_executor::BlockExecutor; +use aptos_executor_types::BlockExecutorTrait; use aptos_logger::info; use aptos_types::transaction::{Transaction, Version}; use aptos_vm::AptosVM; -use executor::block_executor::BlockExecutor; -use executor_types::BlockExecutorTrait; use std::{ sync::{mpsc, Arc}, thread::JoinHandle, diff --git a/execution/executor-benchmark/src/transaction_committer.rs b/execution/executor-benchmark/src/transaction_committer.rs index 1620df189b3b5..3d6cc557fdbcb 100644 --- a/execution/executor-benchmark/src/transaction_committer.rs +++ b/execution/executor-benchmark/src/transaction_committer.rs @@ -2,6 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 use aptos_crypto::hash::HashValue; +use aptos_executor::{ + block_executor::BlockExecutor, + metrics::{ + APTOS_EXECUTOR_COMMIT_BLOCKS_SECONDS, APTOS_EXECUTOR_EXECUTE_BLOCK_SECONDS, + APTOS_EXECUTOR_VM_EXECUTE_BLOCK_SECONDS, + }, +}; +use aptos_executor_types::BlockExecutorTrait; use aptos_logger::prelude::*; use aptos_types::aggregate_signature::AggregateSignature; use aptos_types::{ @@ -11,14 +19,6 @@ use aptos_types::{ }; use aptos_vm::AptosVM; use aptosdb::metrics::API_LATENCY_SECONDS; -use executor::{ - block_executor::BlockExecutor, - metrics::{ - APTOS_EXECUTOR_COMMIT_BLOCKS_SECONDS, APTOS_EXECUTOR_EXECUTE_BLOCK_SECONDS, - APTOS_EXECUTOR_VM_EXECUTE_BLOCK_SECONDS, - }, -}; -use executor_types::BlockExecutorTrait; use std::{ sync::{mpsc, Arc}, time::{Duration, Instant}, diff --git a/execution/executor-benchmark/src/transaction_executor.rs b/execution/executor-benchmark/src/transaction_executor.rs index 9ab85d5e1810b..7eed7c2302281 100644 --- a/execution/executor-benchmark/src/transaction_executor.rs +++ b/execution/executor-benchmark/src/transaction_executor.rs @@ -2,10 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 use aptos_crypto::hash::HashValue; +use aptos_executor::block_executor::BlockExecutor; +use aptos_executor_types::BlockExecutorTrait; use aptos_types::transaction::{Transaction, Version}; use aptos_vm::AptosVM; -use executor::block_executor::BlockExecutor; -use executor_types::BlockExecutorTrait; 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 a14776fdf6e81..1fa4991df20ac 100644 --- a/execution/executor-test-helpers/Cargo.toml +++ b/execution/executor-test-helpers/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "executor-test-helpers" +name = "aptos-executor-test-helpers" description = "Aptos executor test helpers" version = "0.1.0" @@ -14,8 +14,12 @@ rust-version = { workspace = true } [dependencies] anyhow = { workspace = true } +aptos-cached-packages = { workspace = true } aptos-config = { workspace = true } +aptos-consensus-types = { workspace = true } aptos-crypto = { workspace = true } +aptos-executor = { workspace = true } +aptos-executor-types = { workspace = true } aptos-genesis = { workspace = true } aptos-sdk = { workspace = true } aptos-state-view = { workspace = true } @@ -23,10 +27,6 @@ aptos-temppath = { workspace = true } aptos-types = { workspace = true } aptos-vm = { workspace = true } aptosdb = { workspace = true, features = ["fuzzing"] } -cached-packages = { workspace = true } -consensus-types = { workspace = true } -executor = { workspace = true } -executor-types = { workspace = true } rand = { workspace = true } storage-interface = { workspace = true } vm-genesis = { 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 bf61000907d38..cb9385d0ce6d9 100644 --- a/execution/executor-test-helpers/src/integration_test_impl.rs +++ b/execution/executor-test-helpers/src/integration_test_impl.rs @@ -3,6 +3,10 @@ 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_executor::block_executor::BlockExecutor; +use aptos_executor_types::BlockExecutorTrait; use aptos_sdk::{ transaction_builder::TransactionFactory, types::{AccountKey, LocalAccount}, @@ -24,10 +28,6 @@ use aptos_types::{ }; use aptos_vm::AptosVM; use aptosdb::AptosDB; -use cached_packages::aptos_stdlib; -use consensus_types::block::Block; -use executor::block_executor::BlockExecutor; -use executor_types::BlockExecutorTrait; use rand::SeedableRng; use std::sync::Arc; diff --git a/execution/executor-test-helpers/src/lib.rs b/execution/executor-test-helpers/src/lib.rs index b8272fb9ba17b..14395f74eba40 100644 --- a/execution/executor-test-helpers/src/lib.rs +++ b/execution/executor-test-helpers/src/lib.rs @@ -8,6 +8,8 @@ use aptos_crypto::{ ed25519::{Ed25519PrivateKey, Ed25519PublicKey}, HashValue, }; +use aptos_executor::db_bootstrapper::{generate_waypoint, maybe_bootstrap}; +use aptos_executor_types::StateComputeResult; use aptos_types::ledger_info::generate_ledger_info_with_sig; use aptos_types::{ account_address::AccountAddress, @@ -19,8 +21,6 @@ use aptos_types::{ waypoint::Waypoint, }; use aptos_vm::VMExecutor; -use executor::db_bootstrapper::{generate_waypoint, maybe_bootstrap}; -use executor_types::StateComputeResult; use storage_interface::DbReaderWriter; /// Helper function for test to blindly bootstrap without waypoint. diff --git a/execution/executor-types/Cargo.toml b/execution/executor-types/Cargo.toml index da8fc78b73cd6..1bdd33abaf48a 100644 --- a/execution/executor-types/Cargo.toml +++ b/execution/executor-types/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "executor-types" +name = "aptos-executor-types" description = "Aptos executor interface types" version = "0.1.0" diff --git a/execution/executor-types/src/error.rs b/execution/executor-types/src/error.rs index 25253ce504289..b6b3a6ac2efa0 100644 --- a/execution/executor-types/src/error.rs +++ b/execution/executor-types/src/error.rs @@ -13,6 +13,9 @@ pub enum Error { #[error("Cannot find speculation result for block id {0}")] BlockNotFound(HashValue), + #[error("Cannot get data for batch id {0}")] + DataNotFound(HashValue), + #[error( "Bad num_txns_to_commit. first version {}, num to commit: {}, target version: {}", first_version, diff --git a/execution/executor-types/src/lib.rs b/execution/executor-types/src/lib.rs index ffde655278855..597ba2984f94f 100644 --- a/execution/executor-types/src/lib.rs +++ b/execution/executor-types/src/lib.rs @@ -3,7 +3,11 @@ #![forbid(unsafe_code)] -use std::{cmp::max, collections::HashMap, sync::Arc}; +use std::{ + cmp::max, + collections::{BTreeSet, HashMap}, + sync::Arc, +}; use anyhow::Result; use serde::{Deserialize, Serialize}; @@ -122,6 +126,9 @@ pub trait TransactionReplayer: Send { &self, transactions: Vec, transaction_infos: Vec, + writesets: Vec, + events: Vec>, + txns_to_skip: Arc>, ) -> Result<()>; fn commit(&self) -> Result>; diff --git a/execution/executor/Cargo.toml b/execution/executor/Cargo.toml index d1a0bb646bdd3..9f924c1610560 100644 --- a/execution/executor/Cargo.toml +++ b/execution/executor/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "executor" +name = "aptos-executor" description = "Aptos executor" version = "0.1.0" @@ -14,7 +14,9 @@ rust-version = { workspace = true } [dependencies] anyhow = { workspace = true } +aptos-consensus-types = { workspace = true } aptos-crypto = { workspace = true } +aptos-executor-types = { workspace = true } aptos-gas = { workspace = true } aptos-infallible = { workspace = true } aptos-logger = { workspace = true } @@ -24,8 +26,6 @@ aptos-state-view = { workspace = true } aptos-types = { workspace = true } aptos-vm = { workspace = true } bcs = { workspace = true } -consensus-types = { workspace = true } -executor-types = { workspace = true } fail = { workspace = true } itertools = { workspace = true } move-core-types = { workspace = true } @@ -36,13 +36,13 @@ serde = { workspace = true } storage-interface = { workspace = true } [dev-dependencies] +aptos-cached-packages = { workspace = true } aptos-config = { workspace = true } +aptos-executor-test-helpers = { workspace = true } aptos-genesis = { workspace = true } aptos-temppath = { workspace = true } aptos-types = { workspace = true } aptosdb = { workspace = true } -cached-packages = { workspace = true } -executor-test-helpers = { workspace = true } proptest = { workspace = true } rand = { workspace = true } storage-interface = { workspace = true } @@ -50,5 +50,5 @@ vm-genesis = { workspace = true } [features] default = [] -fuzzing = ["consensus-types/fuzzing", "aptos-crypto/fuzzing", "aptos-types/fuzzing", "storage-interface/fuzzing"] +fuzzing = ["aptos-consensus-types/fuzzing", "aptos-crypto/fuzzing", "aptos-types/fuzzing", "storage-interface/fuzzing"] failpoints = ["fail/failpoints", "aptos-vm/failpoints"] diff --git a/execution/executor/src/block_executor.rs b/execution/executor/src/block_executor.rs index c61a9c4ed62e2..d52b2e4a96e31 100644 --- a/execution/executor/src/block_executor.rs +++ b/execution/executor/src/block_executor.rs @@ -6,6 +6,7 @@ use crate::logging::{LogEntry, LogSchema}; use anyhow::Result; use aptos_crypto::HashValue; +use aptos_executor_types::{BlockExecutorTrait, Error, StateComputeResult}; use aptos_infallible::RwLock; use aptos_logger::prelude::*; use aptos_state_view::StateViewId; @@ -14,7 +15,6 @@ use aptos_types::{ transaction::Transaction, }; use aptos_vm::VMExecutor; -use executor_types::{BlockExecutorTrait, Error, StateComputeResult}; use fail::fail_point; use scratchpad::SparseMerkleTree; use std::{marker::PhantomData, sync::Arc}; diff --git a/execution/executor/src/chunk_executor.rs b/execution/executor/src/chunk_executor.rs index df1fc24f4ab9e..9965c62d03604 100644 --- a/execution/executor/src/chunk_executor.rs +++ b/execution/executor/src/chunk_executor.rs @@ -15,22 +15,25 @@ use crate::{ APTOS_EXECUTOR_EXECUTE_CHUNK_SECONDS, APTOS_EXECUTOR_VM_EXECUTE_CHUNK_SECONDS, }, }; -use anyhow::Result; +use anyhow::{anyhow, Result}; +use aptos_executor_types::{ + ChunkCommitNotification, ChunkExecutorTrait, ExecutedChunk, TransactionReplayer, +}; use aptos_infallible::{Mutex, RwLock}; use aptos_logger::prelude::*; use aptos_state_view::StateViewId; use aptos_types::{ + contract_event::ContractEvent, ledger_info::LedgerInfoWithSignatures, transaction::{ - Transaction, TransactionInfo, TransactionListWithProof, TransactionOutputListWithProof, + Transaction, TransactionInfo, TransactionListWithProof, TransactionOutput, + TransactionOutputListWithProof, TransactionStatus, Version, }, + write_set::WriteSet, }; use aptos_vm::VMExecutor; -use executor_types::{ - ChunkCommitNotification, ChunkExecutorTrait, ExecutedChunk, TransactionReplayer, -}; use fail::fail_point; -use std::{marker::PhantomData, sync::Arc}; +use std::{collections::BTreeSet, marker::PhantomData, sync::Arc}; use storage_interface::{ cached_state_view::CachedStateView, sync_proof_fetcher::SyncProofFetcher, DbReaderWriter, ExecutedTrees, @@ -297,13 +300,18 @@ impl TransactionReplayer for ChunkExecutor { &self, transactions: Vec, transaction_infos: Vec, + writesets: Vec, + events: Vec>, + txns_to_skip: Arc>, ) -> Result<()> { self.maybe_initialize()?; - self.inner - .read() - .as_ref() - .expect("not reset") - .replay(transactions, transaction_infos) + self.inner.read().as_ref().expect("not reset").replay( + transactions, + transaction_infos, + writesets, + events, + txns_to_skip, + ) } fn commit(&self) -> Result> { @@ -313,6 +321,60 @@ impl TransactionReplayer for ChunkExecutor { impl TransactionReplayer for ChunkExecutorInner { fn replay( + &self, + mut transactions: Vec, + mut transaction_infos: Vec, + writesets: Vec, + events: Vec>, + txns_to_skip: Arc>, + ) -> Result<()> { + let current_begin_version = { + self.commit_queue + .lock() + .persisted_and_latest_view() + .1 + .version() + .ok_or_else(|| anyhow!("Current version is not available"))? + }; + + let mut offset = current_begin_version; + let total_length = transactions.len(); + + for version in txns_to_skip + .range(current_begin_version + 1..current_begin_version + total_length as u64 + 1) + { + let remaining = transactions.split_off((version - offset) as usize); + let remaining_info = transaction_infos.split_off((version - offset) as usize); + let txn_to_skip = transactions.pop().unwrap(); + let txn_info = transaction_infos.pop().unwrap(); + + self.replay_impl(transactions, transaction_infos)?; + + self.apply_transaction_and_output( + txn_to_skip, + TransactionOutput::new( + writesets[(version - current_begin_version - 1) as usize].clone(), + events[(version - current_begin_version - 1) as usize].clone(), + txn_info.gas_used(), + TransactionStatus::Keep(txn_info.status().clone()), + ), + txn_info, + )?; + + transactions = remaining; + transaction_infos = remaining_info; + offset = version + 1; + } + self.replay_impl(transactions, transaction_infos) + } + + fn commit(&self) -> Result> { + self.commit_chunk_impl() + } +} + +impl ChunkExecutorInner { + fn replay_impl( &self, transactions: Vec, mut transaction_infos: Vec, @@ -322,13 +384,14 @@ impl TransactionReplayer for ChunkExecutorInner { let mut executed_chunk = ExecutedChunk::default(); let mut to_run = Some(transactions); + while !to_run.as_ref().unwrap().is_empty() { // Execute transactions. let state_view = self.state_view(&latest_view)?; let txns = to_run.take().unwrap(); - let (executed, to_discard, to_retry) = - ChunkOutput::by_transaction_execution::(txns, state_view)? - .apply_to_ledger(&latest_view)?; + let chunk_output = ChunkOutput::by_transaction_execution::(txns, state_view)?; + + let (executed, to_discard, to_retry) = chunk_output.apply_to_ledger(&latest_view)?; // Accumulate result and deal with retry ensure_no_discard(to_discard)?; @@ -347,7 +410,30 @@ impl TransactionReplayer for ChunkExecutorInner { Ok(()) } - fn commit(&self) -> Result> { - self.commit_chunk_impl() + fn apply_transaction_and_output( + &self, + txn: Transaction, + output: TransactionOutput, + expected_info: TransactionInfo, + ) -> Result<()> { + let (_persisted_view, latest_view) = self.commit_queue.lock().persisted_and_latest_view(); + + info!( + "Overiding the output of txn at version: {:?}", + latest_view.version().unwrap(), + ); + + let chunk_output = ChunkOutput::by_transaction_output( + vec![(txn, output)], + self.state_view(&latest_view)?, + )?; + + let (executed, to_discard, _to_retry) = chunk_output.apply_to_ledger(&latest_view)?; + + // Accumulate result and deal with retry + ensure_no_discard(to_discard)?; + executed.ensure_transaction_infos_match(&vec![expected_info])?; + self.commit_queue.lock().enqueue(executed); + Ok(()) } } diff --git a/execution/executor/src/components/apply_chunk_output.rs b/execution/executor/src/components/apply_chunk_output.rs index 959e4997c4ebc..fb3fc0193b2b7 100644 --- a/execution/executor/src/components/apply_chunk_output.rs +++ b/execution/executor/src/components/apply_chunk_output.rs @@ -9,16 +9,16 @@ use aptos_crypto::{ hash::{CryptoHash, EventAccumulatorHasher}, HashValue, }; +use aptos_executor_types::{ + in_memory_state_calculator::InMemoryStateCalculator, ExecutedChunk, ParsedTransactionOutput, + TransactionData, +}; use aptos_logger::error; use aptos_types::{ proof::accumulator::InMemoryAccumulator, state_store::{state_key::StateKey, state_value::StateValue}, transaction::{Transaction, TransactionInfo, TransactionOutput, TransactionStatus}, }; -use executor_types::{ - in_memory_state_calculator::InMemoryStateCalculator, ExecutedChunk, ParsedTransactionOutput, - TransactionData, -}; use std::{collections::HashMap, iter::repeat, sync::Arc}; use storage_interface::ExecutedTrees; diff --git a/execution/executor/src/components/block_tree/mod.rs b/execution/executor/src/components/block_tree/mod.rs index c8c41ae149a31..eae24d7049387 100644 --- a/execution/executor/src/components/block_tree/mod.rs +++ b/execution/executor/src/components/block_tree/mod.rs @@ -8,12 +8,12 @@ mod test; use crate::logging::{LogEntry, LogSchema}; use anyhow::{anyhow, ensure, Result}; +use aptos_consensus_types::block::Block as ConsensusBlock; use aptos_crypto::HashValue; +use aptos_executor_types::{Error, ExecutedChunk}; use aptos_infallible::Mutex; use aptos_logger::{debug, info}; use aptos_types::{ledger_info::LedgerInfo, proof::definition::LeafCount}; -use consensus_types::block::Block as ConsensusBlock; -use executor_types::{Error, ExecutedChunk}; use std::{ collections::{hash_map::Entry, HashMap}, sync::{Arc, Weak}, diff --git a/execution/executor/src/components/block_tree/test.rs b/execution/executor/src/components/block_tree/test.rs index f41c6d7ae7f35..5a9ff340f8fcf 100644 --- a/execution/executor/src/components/block_tree/test.rs +++ b/execution/executor/src/components/block_tree/test.rs @@ -3,9 +3,9 @@ use crate::components::block_tree::{epoch_genesis_block_id, BlockLookup, BlockTree}; use aptos_crypto::{hash::PRE_GENESIS_BLOCK_ID, HashValue}; +use aptos_executor_types::ExecutedChunk; use aptos_infallible::Mutex; use aptos_types::{block_info::BlockInfo, epoch_state::EpochState, ledger_info::LedgerInfo}; -use executor_types::ExecutedChunk; use std::sync::Arc; use storage_interface::ExecutedTrees; diff --git a/execution/executor/src/components/chunk_commit_queue.rs b/execution/executor/src/components/chunk_commit_queue.rs index e1a4ff47f32ae..6d5039d894102 100644 --- a/execution/executor/src/components/chunk_commit_queue.rs +++ b/execution/executor/src/components/chunk_commit_queue.rs @@ -5,7 +5,7 @@ use anyhow::{anyhow, Result}; -use executor_types::ExecutedChunk; +use aptos_executor_types::ExecutedChunk; use std::{collections::VecDeque, sync::Arc}; use storage_interface::{DbReader, ExecutedTrees}; diff --git a/execution/executor/src/components/chunk_output.rs b/execution/executor/src/components/chunk_output.rs index 4d1ae9a8b1b1f..ff96c73f7d148 100644 --- a/execution/executor/src/components/chunk_output.rs +++ b/execution/executor/src/components/chunk_output.rs @@ -5,13 +5,13 @@ use crate::{components::apply_chunk_output::ApplyChunkOutput, metrics}; use anyhow::Result; +use aptos_executor_types::ExecutedChunk; use aptos_logger::{trace, warn}; use aptos_types::{ account_config::CORE_CODE_ADDRESS, transaction::{ExecutionStatus, Transaction, TransactionOutput, TransactionStatus}, }; use aptos_vm::{AptosVM, VMExecutor}; -use executor_types::ExecutedChunk; use fail::fail_point; use storage_interface::{ cached_state_view::{CachedStateView, StateCache}, diff --git a/execution/executor/src/db_bootstrapper.rs b/execution/executor/src/db_bootstrapper.rs index 7d65346a01d74..126ea8b985077 100644 --- a/execution/executor/src/db_bootstrapper.rs +++ b/execution/executor/src/db_bootstrapper.rs @@ -6,6 +6,7 @@ use crate::components::chunk_output::ChunkOutput; use anyhow::{anyhow, ensure, format_err, Result}; use aptos_crypto::HashValue; +use aptos_executor_types::ExecutedChunk; use aptos_logger::prelude::*; use aptos_state_view::{StateView, StateViewId}; use aptos_types::aggregate_signature::AggregateSignature; @@ -21,7 +22,6 @@ use aptos_types::{ waypoint::Waypoint, }; use aptos_vm::VMExecutor; -use executor_types::ExecutedChunk; use move_core_types::move_resource::MoveResource; use std::sync::Arc; use storage_interface::{ diff --git a/execution/executor/src/fuzzing.rs b/execution/executor/src/fuzzing.rs index 1dcd172c575fe..8d6f47c097097 100644 --- a/execution/executor/src/fuzzing.rs +++ b/execution/executor/src/fuzzing.rs @@ -4,6 +4,7 @@ use crate::block_executor::BlockExecutor; use anyhow::Result; use aptos_crypto::{hash::SPARSE_MERKLE_PLACEHOLDER_HASH, HashValue}; +use aptos_executor_types::BlockExecutorTrait; use aptos_state_view::StateView; use aptos_types::{ ledger_info::LedgerInfoWithSignatures, @@ -11,7 +12,6 @@ use aptos_types::{ vm_status::VMStatus, }; use aptos_vm::VMExecutor; -use executor_types::BlockExecutorTrait; use storage_interface::{state_delta::StateDelta, DbReader, DbReaderWriter, DbWriter}; fn create_test_executor() -> BlockExecutor { diff --git a/execution/executor/src/tests/chunk_executor_tests.rs b/execution/executor/src/tests/chunk_executor_tests.rs index 395fe581c4f67..ac753bfc067e1 100644 --- a/execution/executor/src/tests/chunk_executor_tests.rs +++ b/execution/executor/src/tests/chunk_executor_tests.rs @@ -11,13 +11,13 @@ use crate::{ tests, }; use aptos_crypto::HashValue; +use aptos_executor_types::{BlockExecutorTrait, ChunkExecutorTrait}; use aptos_types::{ ledger_info::LedgerInfoWithSignatures, test_helpers::transaction_test_helpers::block, transaction::{TransactionListWithProof, TransactionOutputListWithProof}, }; use aptosdb::AptosDB; -use executor_types::{BlockExecutorTrait, ChunkExecutorTrait}; use rand::Rng; use storage_interface::DbReaderWriter; diff --git a/execution/executor/src/tests/mod.rs b/execution/executor/src/tests/mod.rs index bb15d7918ad64..6e819777a4768 100644 --- a/execution/executor/src/tests/mod.rs +++ b/execution/executor/src/tests/mod.rs @@ -1,11 +1,12 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 -use std::{iter::once, sync::Arc}; +use std::{collections::BTreeSet, iter::once, sync::Arc}; use proptest::prelude::*; use aptos_crypto::{ed25519::Ed25519PrivateKey, HashValue, PrivateKey, SigningKey, Uniform}; +use aptos_executor_types::{BlockExecutorTrait, ChunkExecutorTrait, TransactionReplayer}; use aptos_state_view::StateViewId; use aptos_types::aggregate_signature::AggregateSignature; use aptos_types::{ @@ -24,7 +25,6 @@ use aptos_types::{ write_set::{WriteOp, WriteSet, WriteSetMut}, }; use aptosdb::AptosDB; -use executor_types::{BlockExecutorTrait, ChunkExecutorTrait, TransactionReplayer}; use storage_interface::{sync_proof_fetcher::SyncProofFetcher, DbReaderWriter, ExecutedTrees}; use crate::{ @@ -661,7 +661,7 @@ proptest! { // replay txns in one batch across epoch boundary, // and the replayer should deal with `Retry`s automatically let replayer = chunk_executor_tests::TestExecutor::new(); - replayer.executor.replay(block.txns, txn_infos).unwrap(); + replayer.executor.replay(block.txns, txn_infos, vec![], vec![], Arc::new(BTreeSet::new())).unwrap(); replayer.executor.commit().unwrap(); let replayed_db = replayer.db.reader.clone(); prop_assert_eq!( diff --git a/execution/executor/tests/db_bootstrapper_test.rs b/execution/executor/tests/db_bootstrapper_test.rs index f92b80a01162b..63c6eac5b8fe0 100644 --- a/execution/executor/tests/db_bootstrapper_test.rs +++ b/execution/executor/tests/db_bootstrapper_test.rs @@ -3,7 +3,16 @@ #![forbid(unsafe_code)] +use aptos_cached_packages::aptos_stdlib; use aptos_crypto::{ed25519::Ed25519PrivateKey, HashValue, PrivateKey, Uniform}; +use aptos_executor::{ + block_executor::BlockExecutor, + db_bootstrapper::{generate_waypoint, maybe_bootstrap}, +}; +use aptos_executor_test_helpers::{ + bootstrap_genesis, gen_ledger_info_with_sigs, get_test_signed_transaction, +}; +use aptos_executor_types::BlockExecutorTrait; use aptos_gas::LATEST_GAS_FEATURE_VERSION; use aptos_state_view::account_with_state_view::AsAccountWithStateView; use aptos_temppath::TempPath; @@ -28,15 +37,6 @@ use aptos_types::{ }; use aptos_vm::AptosVM; use aptosdb::AptosDB; -use cached_packages::aptos_stdlib; -use executor::{ - block_executor::BlockExecutor, - db_bootstrapper::{generate_waypoint, maybe_bootstrap}, -}; -use executor_test_helpers::{ - bootstrap_genesis, gen_ledger_info_with_sigs, get_test_signed_transaction, -}; -use executor_types::BlockExecutorTrait; use move_core_types::{ language_storage::TypeTag, move_resource::{MoveResource, MoveStructType}, diff --git a/execution/executor/tests/storage_integration_test.rs b/execution/executor/tests/storage_integration_test.rs index 432468813baad..a8fb10dd69d57 100644 --- a/execution/executor/tests/storage_integration_test.rs +++ b/execution/executor/tests/storage_integration_test.rs @@ -1,7 +1,15 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 +use aptos_cached_packages::aptos_stdlib; use aptos_crypto::{hash::CryptoHash, PrivateKey}; +use aptos_executor_test_helpers::{ + gen_block_id, gen_ledger_info_with_sigs, get_test_signed_transaction, + integration_test_impl::{ + create_db_and_executor, test_execution_with_storage_impl, verify_committed_txn_status, + }, +}; +use aptos_executor_types::BlockExecutorTrait; use aptos_state_view::account_with_state_view::AsAccountWithStateView; use aptos_types::{ access_path::AccessPath, @@ -13,14 +21,6 @@ use aptos_types::{ trusted_state::TrustedState, validator_signer::ValidatorSigner, }; -use cached_packages::aptos_stdlib; -use executor_test_helpers::{ - gen_block_id, gen_ledger_info_with_sigs, get_test_signed_transaction, - integration_test_impl::{ - create_db_and_executor, test_execution_with_storage_impl, verify_committed_txn_status, - }, -}; -use executor_types::BlockExecutorTrait; use move_core_types::move_resource::MoveStructType; use storage_interface::state_view::DbStateViewAtVersion; diff --git a/mempool/Cargo.toml b/mempool/Cargo.toml index e1d4310577dc7..a1f7708d85ba8 100644 --- a/mempool/Cargo.toml +++ b/mempool/Cargo.toml @@ -14,8 +14,11 @@ rust-version = { workspace = true } [dependencies] anyhow = { workspace = true } +aptos-bounded-executor = { workspace = true } aptos-config = { workspace = true } +aptos-consensus-types = { workspace = true } aptos-crypto = { workspace = true } +aptos-event-notifications = { workspace = true } aptos-infallible = { workspace = true } aptos-logger = { workspace = true } aptos-metrics-core = { workspace = true } @@ -23,10 +26,7 @@ aptos-proptest-helpers = { workspace = true, optional = true } aptos-types = { workspace = true } async-trait = { workspace = true } bcs = { workspace = true } -bounded-executor = { workspace = true } channel = { workspace = true } -consensus-types = { workspace = true } -event-notifications = { workspace = true } fail = { workspace = true } futures = { workspace = true } itertools = { workspace = true } diff --git a/mempool/src/shared_mempool/coordinator.rs b/mempool/src/shared_mempool/coordinator.rs index dda771f16dfc7..a583cf440db16 100644 --- a/mempool/src/shared_mempool/coordinator.rs +++ b/mempool/src/shared_mempool/coordinator.rs @@ -15,13 +15,13 @@ 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_types::on_chain_config::OnChainConfigPayload; -use bounded_executor::BoundedExecutor; -use consensus_types::common::TransactionSummary; -use event_notifications::ReconfigNotificationListener; use futures::{ channel::mpsc, stream::{select_all, FuturesUnordered}, diff --git a/mempool/src/shared_mempool/runtime.rs b/mempool/src/shared_mempool/runtime.rs index 2eb2866d4a38e..46dbdee8bc08b 100644 --- a/mempool/src/shared_mempool/runtime.rs +++ b/mempool/src/shared_mempool/runtime.rs @@ -13,8 +13,8 @@ use crate::{ use aptos_config::{config::NodeConfig, network_id::NetworkId}; use aptos_infallible::{Mutex, RwLock}; +use aptos_event_notifications::ReconfigNotificationListener; use aptos_logger::Level; -use event_notifications::ReconfigNotificationListener; use futures::channel::mpsc::{self, Receiver, UnboundedSender}; use mempool_notifications::MempoolNotificationListener; use network::application::storage::PeerMetadataStorage; diff --git a/mempool/src/shared_mempool/tasks.rs b/mempool/src/shared_mempool/tasks.rs index c8a393e0d71f8..a77ed920bc745 100644 --- a/mempool/src/shared_mempool/tasks.rs +++ b/mempool/src/shared_mempool/tasks.rs @@ -16,6 +16,7 @@ use crate::{ }; use anyhow::Result; use aptos_config::network_id::PeerNetworkId; +use aptos_consensus_types::common::{RejectedTransactionSummary, TransactionSummary}; use aptos_crypto::HashValue; use aptos_infallible::{Mutex, RwLock}; use aptos_logger::prelude::*; @@ -26,7 +27,6 @@ use aptos_types::{ transaction::SignedTransaction, vm_status::DiscardedVMStatus, }; -use consensus_types::common::{RejectedTransactionSummary, TransactionSummary}; use futures::{channel::oneshot, stream::FuturesUnordered}; use network::application::interface::NetworkInterface; use rayon::prelude::*; diff --git a/mempool/src/shared_mempool/types.rs b/mempool/src/shared_mempool/types.rs index 82bb88e9ac004..634b6d08bd54a 100644 --- a/mempool/src/shared_mempool/types.rs +++ b/mempool/src/shared_mempool/types.rs @@ -11,12 +11,12 @@ use aptos_config::{ config::{MempoolConfig, RoleType}, network_id::{NetworkId, PeerNetworkId}, }; +use aptos_consensus_types::common::{RejectedTransactionSummary, TransactionSummary}; use aptos_crypto::HashValue; use aptos_infallible::{Mutex, RwLock}; use aptos_types::{ mempool_status::MempoolStatus, transaction::SignedTransaction, vm_status::DiscardedVMStatus, }; -use consensus_types::common::{RejectedTransactionSummary, TransactionSummary}; use futures::{ channel::{mpsc, mpsc::UnboundedSender, oneshot}, future::Future, diff --git a/mempool/src/tests/mocks.rs b/mempool/src/tests/mocks.rs index 47b4516f566c4..f5992a77075a7 100644 --- a/mempool/src/tests/mocks.rs +++ b/mempool/src/tests/mocks.rs @@ -12,6 +12,7 @@ use aptos_config::{ config::{NetworkConfig, NodeConfig}, network_id::NetworkId, }; +use aptos_event_notifications::{ReconfigNotification, ReconfigNotificationListener}; use aptos_infallible::{Mutex, RwLock}; use aptos_types::on_chain_config::OnChainConfigPayload; use aptos_types::{ @@ -19,7 +20,6 @@ use aptos_types::{ transaction::SignedTransaction, }; use channel::{self, aptos_channel, message_queues::QueueStyle}; -use event_notifications::{ReconfigNotification, ReconfigNotificationListener}; use futures::channel::mpsc; use mempool_notifications::{self, MempoolNotifier}; use network::{ diff --git a/mempool/src/tests/node.rs b/mempool/src/tests/node.rs index 81316b02ea6de..6aeb1c38a06de 100644 --- a/mempool/src/tests/node.rs +++ b/mempool/src/tests/node.rs @@ -14,12 +14,12 @@ use aptos_config::{ network_id::{NetworkContext, NetworkId, PeerNetworkId}, }; use aptos_crypto::{x25519::PrivateKey, Uniform}; +use aptos_event_notifications::{ReconfigNotification, ReconfigNotificationListener}; use aptos_infallible::{Mutex, MutexGuard, RwLock}; use aptos_types::on_chain_config::OnChainConfigPayload; use aptos_types::{account_config::AccountSequenceInfo, PeerId}; use channel::{aptos_channel, message_queues::QueueStyle}; use enum_dispatch::enum_dispatch; -use event_notifications::{ReconfigNotification, ReconfigNotificationListener}; use futures::{ channel::mpsc::{self, unbounded, UnboundedReceiver}, FutureExt, StreamExt, diff --git a/mempool/src/tests/shared_mempool_test.rs b/mempool/src/tests/shared_mempool_test.rs index 1d86d0a0753a3..283093dd1eed6 100644 --- a/mempool/src/tests/shared_mempool_test.rs +++ b/mempool/src/tests/shared_mempool_test.rs @@ -6,8 +6,8 @@ use crate::{ tests::common::{batch_add_signed_txn, TestTransaction}, QuorumStoreRequest, }; +use aptos_consensus_types::common::RejectedTransactionSummary; use aptos_types::transaction::Transaction; -use consensus_types::common::RejectedTransactionSummary; use futures::{channel::oneshot, executor::block_on, sink::SinkExt}; use mempool_notifications::MempoolNotificationSender; use tokio::runtime::Builder; diff --git a/mempool/src/tests/test_framework.rs b/mempool/src/tests/test_framework.rs index 246022b69971a..e0ced22e7d9d4 100644 --- a/mempool/src/tests/test_framework.rs +++ b/mempool/src/tests/test_framework.rs @@ -14,6 +14,7 @@ use aptos_config::{ config::NodeConfig, network_id::{NetworkId, PeerNetworkId}, }; +use aptos_event_notifications::{ReconfigNotification, ReconfigNotificationListener}; use aptos_id_generator::U32IdGenerator; use aptos_infallible::{Mutex, RwLock}; use aptos_types::on_chain_config::OnChainConfigPayload; @@ -23,7 +24,6 @@ use aptos_types::{ }; use channel::aptos_channel; use channel::message_queues::QueueStyle; -use event_notifications::{ReconfigNotification, ReconfigNotificationListener}; use futures::{channel::oneshot, SinkExt}; use mempool_notifications::MempoolNotifier; use network::{ diff --git a/network/builder/Cargo.toml b/network/builder/Cargo.toml index 5c5a973040761..20c60d1214dc4 100644 --- a/network/builder/Cargo.toml +++ b/network/builder/Cargo.toml @@ -15,6 +15,7 @@ rust-version = { workspace = true } [dependencies] aptos-config = { workspace = true } aptos-crypto = { workspace = true } +aptos-event-notifications = { workspace = true } aptos-infallible = { workspace = true } aptos-logger = { workspace = true } aptos-secure-storage = { workspace = true } @@ -23,7 +24,6 @@ aptos-types = { workspace = true } async-trait = { workspace = true } bcs = { workspace = true } channel = { workspace = true } -event-notifications = { workspace = true } futures = { workspace = true } netcore = { workspace = true } network = { workspace = true } diff --git a/network/builder/src/builder.rs b/network/builder/src/builder.rs index d70e40bb79e3f..f089bca7e4540 100644 --- a/network/builder/src/builder.rs +++ b/network/builder/src/builder.rs @@ -19,11 +19,11 @@ use aptos_config::{ network_id::NetworkContext, }; 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 event_notifications::{EventSubscriptionService, ReconfigNotificationListener}; use network::{ application::storage::PeerMetadataStorage, connectivity_manager::{builder::ConnectivityManagerBuilder, ConnectivityRequest}, diff --git a/network/discovery/Cargo.toml b/network/discovery/Cargo.toml index 1c233e5c1bc90..f54926ba3b391 100644 --- a/network/discovery/Cargo.toml +++ b/network/discovery/Cargo.toml @@ -16,6 +16,7 @@ rust-version = { workspace = true } anyhow = { workspace = true } aptos-config = { workspace = true } aptos-crypto = { workspace = true } +aptos-event-notifications = { workspace = true } aptos-logger = { workspace = true } aptos-metrics-core = { workspace = true } aptos-secure-storage = { workspace = true } @@ -23,7 +24,6 @@ aptos-time-service = { workspace = true } aptos-types = { workspace = true } bcs = { workspace = true } channel = { workspace = true } -event-notifications = { workspace = true } futures = { workspace = true } network = { workspace = true } once_cell = { workspace = true } diff --git a/network/discovery/src/lib.rs b/network/discovery/src/lib.rs index acce90634ad4d..a404d8463ee46 100644 --- a/network/discovery/src/lib.rs +++ b/network/discovery/src/lib.rs @@ -4,9 +4,9 @@ use crate::{counters::DISCOVERY_COUNTS, file::FileStream, validator_set::ValidatorSetStream}; 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 event_notifications::ReconfigNotificationListener; use futures::{Stream, StreamExt}; use network::{ connectivity_manager::{ConnectivityRequest, DiscoverySource}, diff --git a/network/discovery/src/validator_set.rs b/network/discovery/src/validator_set.rs index a5ade68fd6f46..da25f1887fb4f 100644 --- a/network/discovery/src/validator_set.rs +++ b/network/discovery/src/validator_set.rs @@ -10,9 +10,9 @@ use aptos_config::{ network_id::NetworkContext, }; use aptos_crypto::x25519; +use aptos_event_notifications::ReconfigNotificationListener; use aptos_logger::prelude::*; use aptos_types::on_chain_config::{OnChainConfigPayload, ValidatorSet}; -use event_notifications::ReconfigNotificationListener; use futures::Stream; use network::{counters::inc_by_with_context, logging::NetworkSchema}; use short_hex_str::AsShortHexStr; @@ -155,12 +155,12 @@ mod tests { use crate::DiscoveryChangeListener; use aptos_config::config::HANDSHAKE_VERSION; use aptos_crypto::{bls12381, x25519::PrivateKey, PrivateKey as PK, Uniform}; + use aptos_event_notifications::ReconfigNotification; use aptos_types::{ network_address::NetworkAddress, on_chain_config::OnChainConfig, validator_config::ValidatorConfig, validator_info::ValidatorInfo, PeerId, }; use channel::{aptos_channel, message_queues::QueueStyle}; - use event_notifications::ReconfigNotification; use futures::executor::block_on; use rand::{rngs::StdRng, SeedableRng}; use std::{collections::HashMap, sync::Arc, time::Instant}; diff --git a/network/peer-monitoring-service/server/Cargo.toml b/network/peer-monitoring-service/server/Cargo.toml index 48832c7ba603a..37a8dfc65c4b3 100644 --- a/network/peer-monitoring-service/server/Cargo.toml +++ b/network/peer-monitoring-service/server/Cargo.toml @@ -13,12 +13,12 @@ repository = { workspace = true } rust-version = { workspace = true } [dependencies] +aptos-bounded-executor = { workspace = true } aptos-config = { workspace = true } aptos-logger = { workspace = true } aptos-metrics-core = { workspace = true } aptos-types = { workspace = true } bcs = { workspace = true } -bounded-executor = { workspace = true } bytes = { workspace = true } channel = { workspace = true } futures = { workspace = true } diff --git a/network/peer-monitoring-service/server/src/lib.rs b/network/peer-monitoring-service/server/src/lib.rs index 5971e99e3ff47..5626ba7608d78 100644 --- a/network/peer-monitoring-service/server/src/lib.rs +++ b/network/peer-monitoring-service/server/src/lib.rs @@ -9,9 +9,9 @@ use crate::{ network::PeerMonitoringServiceNetworkEvents, }; use ::network::{application::storage::PeerMetadataStorage, ProtocolId}; +use aptos_bounded_executor::BoundedExecutor; use aptos_config::config::PeerMonitoringServiceConfig; use aptos_logger::prelude::*; -use bounded_executor::BoundedExecutor; use futures::stream::StreamExt; use peer_monitoring_service_types::{ ConnectedPeersResponse, PeerMonitoringServiceError, PeerMonitoringServiceRequest, diff --git a/scripts/rust_lint.sh b/scripts/rust_lint.sh index a2e611957ffb9..4c4712b3e3dc3 100755 --- a/scripts/rust_lint.sh +++ b/scripts/rust_lint.sh @@ -32,3 +32,12 @@ cargo fmt $CHECK_ARG # we can move to cleaner workspace dependency notation. # See: https://github.com/DevinR528/cargo-sort/issues/47 cargo sort --grouped --workspace $CHECK_ARG + +# Ensure that aptos-cached-packages have been built correctly. +cargo build -p aptos-cached-packages +if [ -n "$CHECK_ARG" ]; then + if [ -n "$(git status --porcelain -uno)" ]; then + echo "There are unstaged changes after running 'cargo build -p aptos-cached-packages'! Are you sure aptos-cached-packages is up-to-date?" + exit 1 + fi +fi diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index ce6e1a31ea8c5..a183e66394ab6 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -14,12 +14,12 @@ rust-version = { workspace = true } [dependencies] anyhow = { workspace = true } +aptos-cached-packages = { workspace = true } aptos-crypto = { workspace = true } aptos-global-constants = { workspace = true } aptos-rest-client = { workspace = true } aptos-types = { workspace = true } bcs = { workspace = true } -cached-packages = { workspace = true } ed25519-dalek-bip32 = { workspace = true } move-core-types = { workspace = true } rand_core = { workspace = true } diff --git a/sdk/src/transaction_builder.rs b/sdk/src/transaction_builder.rs index 2699015e7e87d..cac7229b54f4c 100644 --- a/sdk/src/transaction_builder.rs +++ b/sdk/src/transaction_builder.rs @@ -8,12 +8,12 @@ use crate::{ transaction::{authenticator::AuthenticationKey, RawTransaction, TransactionPayload}, }, }; +pub use aptos_cached_packages::aptos_stdlib; use aptos_crypto::ed25519::Ed25519PublicKey; use aptos_global_constants::{GAS_UNIT_PRICE, MAX_GAS_AMOUNT}; use aptos_types::transaction::{ authenticator::AuthenticationKeyPreimage, EntryFunction, ModuleBundle, Script, }; -pub use cached_packages::aptos_stdlib; pub struct TransactionBuilder { sender: Option, diff --git a/state-sync/inter-component/consensus-notifications/Cargo.toml b/state-sync/inter-component/consensus-notifications/Cargo.toml index 5414597a5754b..0842e66e605b1 100644 --- a/state-sync/inter-component/consensus-notifications/Cargo.toml +++ b/state-sync/inter-component/consensus-notifications/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "consensus-notifications" +name = "aptos-consensus-notifications" description = "The notification interface between state sync and consensus" version = "0.1.0" diff --git a/state-sync/inter-component/event-notifications/Cargo.toml b/state-sync/inter-component/event-notifications/Cargo.toml index 82d732b8cce6e..5b2bd527280d2 100644 --- a/state-sync/inter-component/event-notifications/Cargo.toml +++ b/state-sync/inter-component/event-notifications/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "event-notifications" +name = "aptos-event-notifications" description = "The notification service offered by state sync for on-chain events" version = "0.1.0" @@ -26,12 +26,12 @@ thiserror = { workspace = true } [dev-dependencies] aptos-crypto = { workspace = true } +aptos-executor-test-helpers = { workspace = true } aptos-temppath = { workspace = true } aptos-vm = { workspace = true } aptosdb = { workspace = true } bcs = { workspace = true } claims = { workspace = true } -executor-test-helpers = { workspace = true } move-binary-format = { workspace = true } move-core-types = { workspace = true } vm-genesis = { 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 1631953660f73..e3bfca60c3520 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_executor_test_helpers::bootstrap_genesis; use aptos_infallible::RwLock; use aptos_types::{ account_address::AccountAddress, @@ -19,7 +20,6 @@ use aptos_types::{ use aptos_vm::AptosVM; use aptosdb::AptosDB; use claims::{assert_lt, assert_matches, assert_ok}; -use executor_test_helpers::bootstrap_genesis; use futures::{FutureExt, StreamExt}; use move_core_types::language_storage::TypeTag; use serde::{Deserialize, Serialize}; 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 a7accc7e1c900..d40c40d86703b 100644 --- a/state-sync/state-sync-v2/data-streaming-service/Cargo.toml +++ b/state-sync/state-sync-v2/data-streaming-service/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "data-streaming-service" +name = "aptos-data-streaming-service" description = "The data streaming service that sends data notifications to clients" version = "0.1.0" 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 c037ba0491835..7d1f6b6d718a5 100644 --- a/state-sync/state-sync-v2/state-sync-driver/Cargo.toml +++ b/state-sync/state-sync-v2/state-sync-driver/Cargo.toml @@ -15,18 +15,18 @@ rust-version = { workspace = true } [dependencies] anyhow = { workspace = true } aptos-config = { workspace = true } +aptos-consensus-notifications = { workspace = true } aptos-crypto = { workspace = true } aptos-data-client = { workspace = true } +aptos-data-streaming-service = { workspace = true } +aptos-event-notifications = { workspace = true } +aptos-executor-types = { workspace = true } aptos-infallible = { workspace = true } aptos-logger = { workspace = true } aptos-metrics-core = { workspace = true } aptos-types = { workspace = true } async-trait = { workspace = true } bcs = { workspace = true } -consensus-notifications = { workspace = true } -data-streaming-service = { workspace = true } -event-notifications = { workspace = true } -executor-types = { workspace = true } futures = { workspace = true } mempool-notifications = { workspace = true } once_cell = { workspace = true } @@ -41,6 +41,8 @@ tokio-stream = { workspace = true } [dev-dependencies] anyhow = { workspace = true } aptos-crypto = { workspace = true } +aptos-executor = { workspace = true } +aptos-executor-test-helpers = { workspace = true } aptos-genesis = { workspace = true, features = ["testing"] } aptos-temppath = { workspace = true } aptos-time-service = { workspace = true, features = ["async", "testing"] } @@ -50,8 +52,6 @@ async-trait = { workspace = true } bcs = { workspace = true } channel = { workspace = true } claims = { workspace = true } -executor = { workspace = true } -executor-test-helpers = { workspace = true } mockall = { workspace = true } move-core-types = { workspace = true } network = { workspace = true } diff --git a/state-sync/state-sync-v2/state-sync-driver/src/bootstrapper.rs b/state-sync/state-sync-v2/state-sync-driver/src/bootstrapper.rs index d0988f91c502a..1d23ace4f835c 100644 --- a/state-sync/state-sync-v2/state-sync-driver/src/bootstrapper.rs +++ b/state-sync/state-sync-v2/state-sync-driver/src/bootstrapper.rs @@ -12,6 +12,11 @@ use crate::{ }; use aptos_config::config::BootstrappingMode; use aptos_data_client::GlobalDataSummary; +use aptos_data_streaming_service::{ + data_notification::{DataNotification, DataPayload, NotificationId}, + data_stream::DataStreamListener, + streaming_client::{DataStreamingClient, NotificationAndFeedback, NotificationFeedback}, +}; use aptos_logger::{prelude::*, sample::SampleRate}; use aptos_types::{ epoch_change::Verifier, @@ -21,11 +26,6 @@ use aptos_types::{ transaction::{TransactionListWithProof, TransactionOutputListWithProof, Version}, waypoint::Waypoint, }; -use data_streaming_service::{ - data_notification::{DataNotification, DataPayload, NotificationId}, - data_stream::DataStreamListener, - streaming_client::{DataStreamingClient, NotificationAndFeedback, NotificationFeedback}, -}; use futures::channel::oneshot; use std::{collections::BTreeMap, sync::Arc, time::Duration}; use storage_interface::DbReader; diff --git a/state-sync/state-sync-v2/state-sync-driver/src/continuous_syncer.rs b/state-sync/state-sync-v2/state-sync-driver/src/continuous_syncer.rs index f7658ce8547c7..772a5c6f79871 100644 --- a/state-sync/state-sync-v2/state-sync-driver/src/continuous_syncer.rs +++ b/state-sync/state-sync-v2/state-sync-driver/src/continuous_syncer.rs @@ -10,18 +10,18 @@ use crate::{ utils::{SpeculativeStreamState, PENDING_DATA_LOG_FREQ_SECS}, }; use aptos_config::config::ContinuousSyncingMode; +use aptos_data_streaming_service::streaming_client::NotificationAndFeedback; +use aptos_data_streaming_service::{ + data_notification::{DataNotification, DataPayload, NotificationId}, + data_stream::DataStreamListener, + streaming_client::{DataStreamingClient, Epoch, NotificationFeedback}, +}; use aptos_infallible::Mutex; use aptos_logger::{prelude::*, sample, sample::SampleRate}; use aptos_types::{ ledger_info::LedgerInfoWithSignatures, transaction::{TransactionListWithProof, TransactionOutputListWithProof, Version}, }; -use data_streaming_service::streaming_client::NotificationAndFeedback; -use data_streaming_service::{ - data_notification::{DataNotification, DataPayload, NotificationId}, - data_stream::DataStreamListener, - streaming_client::{DataStreamingClient, Epoch, NotificationFeedback}, -}; use std::{sync::Arc, time::Duration}; use storage_interface::DbReader; 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 6fe7a2f94d513..850066063b25a 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 @@ -20,17 +20,17 @@ use crate::{ utils::PENDING_DATA_LOG_FREQ_SECS, }; use aptos_config::config::{RoleType, StateSyncDriverConfig}; -use aptos_data_client::AptosDataClient; -use aptos_infallible::Mutex; -use aptos_logger::prelude::*; -use aptos_types::waypoint::Waypoint; -use consensus_notifications::{ +use aptos_consensus_notifications::{ ConsensusCommitNotification, ConsensusNotification, ConsensusSyncNotification, }; -use data_streaming_service::streaming_client::{ +use aptos_data_client::AptosDataClient; +use aptos_data_streaming_service::streaming_client::{ DataStreamingClient, NotificationAndFeedback, NotificationFeedback, }; -use event_notifications::EventSubscriptionService; +use aptos_event_notifications::EventSubscriptionService; +use aptos_infallible::Mutex; +use aptos_logger::prelude::*; +use aptos_types::waypoint::Waypoint; use futures::StreamExt; use mempool_notifications::MempoolNotificationSender; use std::{sync::Arc, time::SystemTime}; 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 ef6cda1145a28..d7e251ba37b04 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 @@ -12,13 +12,13 @@ use crate::{ storage_synchronizer::StorageSynchronizer, }; use aptos_config::config::NodeConfig; +use aptos_consensus_notifications::ConsensusNotificationListener; use aptos_data_client::aptosnet::AptosNetDataClient; +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_types::{move_resource::MoveStorage, waypoint::Waypoint}; -use consensus_notifications::ConsensusNotificationListener; -use data_streaming_service::streaming_client::StreamingServiceClient; -use event_notifications::{EventNotificationSender, EventSubscriptionService}; -use executor_types::ChunkExecutorTrait; use futures::{channel::mpsc, executor::block_on}; use mempool_notifications::MempoolNotificationSender; use std::sync::{ diff --git a/state-sync/state-sync-v2/state-sync-driver/src/error.rs b/state-sync/state-sync-v2/state-sync-driver/src/error.rs index 2020d16d1edb6..c60bdea1a748d 100644 --- a/state-sync/state-sync-v2/state-sync-driver/src/error.rs +++ b/state-sync/state-sync-v2/state-sync-driver/src/error.rs @@ -75,14 +75,14 @@ impl From for Error { } } -impl From for Error { - fn from(error: data_streaming_service::error::Error) -> Self { +impl From for Error { + fn from(error: aptos_data_streaming_service::error::Error) -> Self { Error::UnexpectedError(error.to_string()) } } -impl From for Error { - fn from(error: event_notifications::Error) -> Self { +impl From for Error { + fn from(error: aptos_event_notifications::Error) -> Self { Error::EventNotificationError(error.to_string()) } } 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 eaf7bcf7b7f51..7fb23bfa82ef8 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 @@ -5,6 +5,12 @@ use crate::{ error::Error, logging::{LogEntry, LogSchema}, }; +use aptos_consensus_notifications::{ + ConsensusCommitNotification, ConsensusNotification, ConsensusNotificationListener, + ConsensusSyncNotification, +}; +use aptos_data_streaming_service::data_notification::NotificationId; +use aptos_event_notifications::{EventNotificationSender, EventSubscriptionService}; use aptos_infallible::Mutex; use aptos_logger::prelude::*; use aptos_types::{ @@ -12,12 +18,6 @@ use aptos_types::{ ledger_info::LedgerInfoWithSignatures, transaction::{Transaction, Version}, }; -use consensus_notifications::{ - ConsensusCommitNotification, ConsensusNotification, ConsensusNotificationListener, - ConsensusSyncNotification, -}; -use data_streaming_service::data_notification::NotificationId; -use event_notifications::{EventNotificationSender, EventSubscriptionService}; use futures::{channel::mpsc, stream::FusedStream, Stream}; use mempool_notifications::MempoolNotificationSender; use serde::Serialize; @@ -283,7 +283,7 @@ impl ConsensusNotificationHandler { ) -> Result<(), Error> { // Wrap the result in an error that consensus can process let message = result.map_err(|error| { - consensus_notifications::Error::UnexpectedErrorEncountered(format!("{:?}", error)) + aptos_consensus_notifications::Error::UnexpectedErrorEncountered(format!("{:?}", error)) }); info!( @@ -313,7 +313,7 @@ impl ConsensusNotificationHandler { ) -> Result<(), Error> { // Wrap the result in an error that consensus can process let message = result.map_err(|error| { - consensus_notifications::Error::UnexpectedErrorEncountered(format!("{:?}", error)) + aptos_consensus_notifications::Error::UnexpectedErrorEncountered(format!("{:?}", error)) }); debug!( 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 14bec1a3320d5..89db1045cd0d5 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 @@ -12,6 +12,9 @@ use crate::{ utils, }; use aptos_config::config::StateSyncDriverConfig; +use aptos_data_streaming_service::data_notification::NotificationId; +use aptos_event_notifications::EventSubscriptionService; +use aptos_executor_types::ChunkExecutorTrait; use aptos_infallible::Mutex; use aptos_logger::prelude::*; use aptos_types::state_store::state_key::StateKey; @@ -25,9 +28,6 @@ use aptos_types::{ }, }; use async_trait::async_trait; -use data_streaming_service::data_notification::NotificationId; -use event_notifications::EventSubscriptionService; -use executor_types::ChunkExecutorTrait; use futures::channel::mpsc::UnboundedSender; use futures::{channel::mpsc, SinkExt, StreamExt}; use mempool_notifications::MempoolNotificationSender; @@ -663,11 +663,19 @@ fn spawn_state_snapshot_receiver< last_committed_state_index )) ); + + let operation_label = + metrics::StorageSynchronizerOperations::SyncedStates.get_label(); metrics::set_gauge( &metrics::STORAGE_SYNCHRONIZER_OPERATIONS, - metrics::StorageSynchronizerOperations::SyncedStates.get_label(), + operation_label, last_committed_state_index as u64, ); + metrics::observe_value( + &metrics::STORAGE_SYNCHRONIZER_CHUNK_SIZES, + operation_label, + num_state_values as u64, + ); if !all_states_synced { // Update the metadata storage with the last committed state index diff --git a/state-sync/state-sync-v2/state-sync-driver/src/tests/bootstrapper.rs b/state-sync/state-sync-v2/state-sync-driver/src/tests/bootstrapper.rs index a17f83b007b38..b0f7c2d6fb28c 100644 --- a/state-sync/state-sync-v2/state-sync-driver/src/tests/bootstrapper.rs +++ b/state-sync/state-sync-v2/state-sync-driver/src/tests/bootstrapper.rs @@ -20,15 +20,15 @@ use crate::{ }; use aptos_config::config::BootstrappingMode; use aptos_data_client::GlobalDataSummary; +use aptos_data_streaming_service::{ + data_notification::{DataNotification, DataPayload}, + streaming_client::{NotificationAndFeedback, NotificationFeedback}, +}; use aptos_types::{ transaction::{TransactionOutputListWithProof, Version}, waypoint::Waypoint, }; use claims::{assert_matches, assert_none, assert_ok}; -use data_streaming_service::{ - data_notification::{DataNotification, DataPayload}, - streaming_client::{NotificationAndFeedback, NotificationFeedback}, -}; use futures::{channel::oneshot, FutureExt, SinkExt}; use mockall::{predicate::eq, Sequence}; use std::sync::Arc; diff --git a/state-sync/state-sync-v2/state-sync-driver/src/tests/continuous_syncer.rs b/state-sync/state-sync-v2/state-sync-driver/src/tests/continuous_syncer.rs index 946775bf542b0..a975b08e67b9d 100644 --- a/state-sync/state-sync-v2/state-sync-driver/src/tests/continuous_syncer.rs +++ b/state-sync/state-sync-v2/state-sync-driver/src/tests/continuous_syncer.rs @@ -18,14 +18,14 @@ use crate::{ }, }; use aptos_config::config::ContinuousSyncingMode; -use aptos_infallible::Mutex; -use aptos_types::transaction::{TransactionOutputListWithProof, Version}; -use claims::assert_matches; -use consensus_notifications::ConsensusSyncNotification; -use data_streaming_service::{ +use aptos_consensus_notifications::ConsensusSyncNotification; +use aptos_data_streaming_service::{ data_notification::{DataNotification, DataPayload}, streaming_client::{NotificationAndFeedback, NotificationFeedback}, }; +use aptos_infallible::Mutex; +use aptos_types::transaction::{TransactionOutputListWithProof, Version}; +use claims::assert_matches; use futures::SinkExt; use mockall::{predicate::eq, Sequence}; use std::sync::Arc; 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 672400f5394c8..94d8d5d1ac3a1 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 @@ -10,7 +10,14 @@ use crate::{ }, }; 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_event_notifications::{ + EventNotificationListener, EventSubscriptionService, ReconfigNotificationListener, +}; +use aptos_executor::chunk_executor::ChunkExecutor; +use aptos_executor_test_helpers::bootstrap_genesis; use aptos_infallible::RwLock; use aptos_time_service::TimeService; use aptos_types::{ @@ -22,13 +29,6 @@ use aptos_types::{ use aptos_vm::AptosVM; use aptosdb::AptosDB; use claims::{assert_err, assert_none}; -use consensus_notifications::{ConsensusNotificationSender, ConsensusNotifier}; -use data_streaming_service::streaming_client::new_streaming_service_client_listener_pair; -use event_notifications::{ - EventNotificationListener, EventSubscriptionService, ReconfigNotificationListener, -}; -use executor::chunk_executor::ChunkExecutor; -use executor_test_helpers::bootstrap_genesis; use futures::{FutureExt, StreamExt}; use mempool_notifications::MempoolNotificationListener; use network::application::{interface::MultiNetworkSender, storage::PeerMetadataStorage}; @@ -251,7 +251,7 @@ async fn create_driver_for_tests( // Create consensus and mempool notifiers and listeners let (consensus_notifier, consensus_listener) = - consensus_notifications::new_consensus_notifier_listener_pair(5000); + aptos_consensus_notifications::new_consensus_notifier_listener_pair(5000); let (mempool_notifier, mempool_listener) = mempool_notifications::new_mempool_notifier_listener_pair(); 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 ed225dc4f3d6c..ab0e079b7771b 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 @@ -9,7 +9,12 @@ use aptos_config::{ }, utils::get_genesis_txn, }; +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_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_temppath::TempPath; @@ -17,11 +22,6 @@ use aptos_time_service::TimeService; use aptos_types::on_chain_config::ON_CHAIN_CONFIG_REGISTRY; use aptos_vm::AptosVM; use aptosdb::AptosDB; -use consensus_notifications::new_consensus_notifier_listener_pair; -use data_streaming_service::streaming_client::new_streaming_service_client_listener_pair; -use event_notifications::EventSubscriptionService; -use executor::chunk_executor::ChunkExecutor; -use executor_test_helpers::bootstrap_genesis; use futures::{FutureExt, StreamExt}; use mempool_notifications::new_mempool_notifier_listener_pair; use network::application::{interface::MultiNetworkSender, storage::PeerMetadataStorage}; diff --git a/state-sync/state-sync-v2/state-sync-driver/src/tests/mocks.rs b/state-sync/state-sync-v2/state-sync-driver/src/tests/mocks.rs index 2be66f0152322..4c645d24cd87d 100644 --- a/state-sync/state-sync-v2/state-sync-driver/src/tests/mocks.rs +++ b/state-sync/state-sync-v2/state-sync-driver/src/tests/mocks.rs @@ -8,6 +8,14 @@ use crate::{ }; use anyhow::Result; use aptos_crypto::HashValue; +use aptos_data_streaming_service::data_stream::DataStreamId; +use aptos_data_streaming_service::streaming_client::NotificationAndFeedback; +use aptos_data_streaming_service::{ + data_notification::NotificationId, + data_stream::DataStreamListener, + streaming_client::{DataStreamingClient, Epoch}, +}; +use aptos_executor_types::{ChunkCommitNotification, ChunkExecutorTrait}; use aptos_types::epoch_state::EpochState; use aptos_types::{ account_address::AccountAddress, @@ -30,14 +38,6 @@ use aptos_types::{ }, }; use async_trait::async_trait; -use data_streaming_service::data_stream::DataStreamId; -use data_streaming_service::streaming_client::NotificationAndFeedback; -use data_streaming_service::{ - data_notification::NotificationId, - data_stream::DataStreamListener, - streaming_client::{DataStreamingClient, Epoch}, -}; -use executor_types::{ChunkCommitNotification, ChunkExecutorTrait}; use mockall::mock; use std::sync::Arc; use storage_interface::{ @@ -355,19 +355,19 @@ mock! { &self, version: Version, start_index: Option, - ) -> Result; + ) -> Result; async fn get_all_epoch_ending_ledger_infos( &self, start_epoch: Epoch, - ) -> Result; + ) -> Result; async fn get_all_transaction_outputs( &self, start_version: Version, end_version: Version, proof_version: Version, - ) -> Result; + ) -> Result; async fn get_all_transactions( &self, @@ -375,14 +375,14 @@ mock! { end_version: Version, proof_version: Version, include_events: bool, - ) -> Result; + ) -> Result; async fn continuously_stream_transaction_outputs( &self, start_version: Version, start_epoch: Epoch, target: Option, - ) -> Result; + ) -> Result; async fn continuously_stream_transactions( &self, @@ -390,13 +390,13 @@ mock! { start_epoch: Epoch, include_events: bool, target: Option, - ) -> Result; + ) -> Result; async fn terminate_stream_with_feedback( &self, data_stream_id: DataStreamId, notification_and_feedback: Option, - ) -> Result<(), data_streaming_service::error::Error>; + ) -> Result<(), aptos_data_streaming_service::error::Error>; } impl Clone for StreamingClient { fn clone(&self) -> Self; 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 d04ccbde0bae6..7c0fe9d5ca641 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 @@ -23,6 +23,9 @@ use crate::{ }; use anyhow::format_err; use aptos_config::config::StateSyncDriverConfig; +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_types::{ ledger_info::LedgerInfoWithSignatures, @@ -30,9 +33,6 @@ use aptos_types::{ transaction::{TransactionOutputListWithProof, Version}, }; use claims::assert_matches; -use data_streaming_service::data_notification::NotificationId; -use event_notifications::EventSubscriptionService; -use executor_types::ChunkCommitNotification; use futures::StreamExt; use mempool_notifications::MempoolNotificationListener; use mockall::predicate::always; 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 5283f8e82d5b3..b80a4334f18db 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 @@ -8,6 +8,10 @@ use aptos_crypto::{ HashValue, PrivateKey, Uniform, }; use aptos_data_client::GlobalDataSummary; +use aptos_data_streaming_service::{ + data_notification::DataNotification, data_stream::DataStreamListener, streaming_client::Epoch, +}; +use aptos_event_notifications::EventNotificationListener; use aptos_types::aggregate_signature::AggregateSignature; use aptos_types::on_chain_config::ValidatorSet; use aptos_types::{ @@ -30,10 +34,6 @@ use aptos_types::{ waypoint::Waypoint, write_set::WriteSet, }; -use data_streaming_service::{ - data_notification::DataNotification, data_stream::DataStreamListener, streaming_client::Epoch, -}; -use event_notifications::EventNotificationListener; use futures::channel::mpsc; use futures::StreamExt; use mempool_notifications::{CommittedTransaction, MempoolNotificationListener}; 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 e2bb08abfd06f..df9ce108675a4 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 @@ -9,19 +9,19 @@ use crate::{ CommitNotification, CommittedTransactions, MempoolNotificationHandler, }, }; +use aptos_data_streaming_service::data_stream::DataStreamId; +use aptos_data_streaming_service::streaming_client::NotificationAndFeedback; +use aptos_data_streaming_service::{ + data_notification::DataNotification, data_stream::DataStreamListener, + streaming_client::DataStreamingClient, +}; +use aptos_event_notifications::EventSubscriptionService; use aptos_infallible::Mutex; use aptos_logger::prelude::*; use aptos_types::{ epoch_change::Verifier, epoch_state::EpochState, ledger_info::LedgerInfoWithSignatures, transaction::Version, }; -use data_streaming_service::data_stream::DataStreamId; -use data_streaming_service::streaming_client::NotificationAndFeedback; -use data_streaming_service::{ - data_notification::DataNotification, data_stream::DataStreamListener, - streaming_client::DataStreamingClient, -}; -use event_notifications::EventSubscriptionService; use futures::StreamExt; use mempool_notifications::MempoolNotificationSender; use std::{sync::Arc, time::Duration}; diff --git a/state-sync/storage-service/server/Cargo.toml b/state-sync/storage-service/server/Cargo.toml index bdf1b455f5a43..d2e25db559c9d 100644 --- a/state-sync/storage-service/server/Cargo.toml +++ b/state-sync/storage-service/server/Cargo.toml @@ -13,6 +13,7 @@ repository = { workspace = true } rust-version = { workspace = true } [dependencies] +aptos-bounded-executor = { workspace = true } aptos-config = { workspace = true } aptos-infallible = { workspace = true } aptos-logger = { workspace = true } @@ -20,7 +21,6 @@ aptos-metrics-core = { workspace = true } aptos-time-service = { workspace = true } aptos-types = { workspace = true } bcs = { workspace = true } -bounded-executor = { workspace = true } bytes = { workspace = true } channel = { workspace = true } futures = { workspace = true } diff --git a/state-sync/storage-service/server/src/lib.rs b/state-sync/storage-service/server/src/lib.rs index eb868477868f4..54cce2609a893 100644 --- a/state-sync/storage-service/server/src/lib.rs +++ b/state-sync/storage-service/server/src/lib.rs @@ -10,6 +10,7 @@ use crate::{ 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::*; @@ -21,7 +22,6 @@ use aptos_types::{ state_store::state_value::StateValueChunkWithProof, transaction::{TransactionListWithProof, TransactionOutputListWithProof, Version}, }; -use bounded_executor::BoundedExecutor; use futures::stream::StreamExt; use lru::LruCache; use serde::{Deserialize, Serialize}; diff --git a/storage/aptosdb/Cargo.toml b/storage/aptosdb/Cargo.toml index 3c1202efd10df..10bbc4622d9eb 100644 --- a/storage/aptosdb/Cargo.toml +++ b/storage/aptosdb/Cargo.toml @@ -17,6 +17,7 @@ anyhow = { workspace = true } aptos-accumulator = { workspace = true } aptos-config = { workspace = true } aptos-crypto = { workspace = true } +aptos-executor-types = { workspace = true } aptos-infallible = { workspace = true } aptos-jellyfish-merkle = { workspace = true } aptos-logger = { workspace = true } @@ -32,7 +33,6 @@ arc-swap = { workspace = true } arr_macro = { workspace = true } bcs = { workspace = true } byteorder = { workspace = true } -executor-types = { workspace = true } itertools = { workspace = true } lru = { workspace = true } move-core-types = { workspace = true } @@ -49,11 +49,11 @@ storage-interface = { workspace = true } thiserror = { workspace = true } [dev-dependencies] +aptos-executor-types = { workspace = true } aptos-jellyfish-merkle = { workspace = true, features = ["fuzzing"] } aptos-proptest-helpers = { workspace = true } aptos-temppath = { workspace = true } aptos-types = { workspace = true } -executor-types = { workspace = true } proptest = { workspace = true } proptest-derive = { workspace = true } rand = { workspace = true } @@ -62,4 +62,4 @@ scratchpad = { 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", "executor-types/fuzzing", "schemadb/fuzzing", "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", "schemadb/fuzzing", "scratchpad/fuzzing"] diff --git a/storage/aptosdb/src/state_store/mod.rs b/storage/aptosdb/src/state_store/mod.rs index e4b7484c816da..bdab43a1d7702 100644 --- a/storage/aptosdb/src/state_store/mod.rs +++ b/storage/aptosdb/src/state_store/mod.rs @@ -22,6 +22,7 @@ use aptos_crypto::{ hash::{CryptoHash, SPARSE_MERKLE_PLACEHOLDER_HASH}, HashValue, }; +use aptos_executor_types::in_memory_state_calculator::InMemoryStateCalculator; use aptos_infallible::Mutex; use aptos_jellyfish_merkle::iterator::JellyfishMerkleIterator; use aptos_logger::info; @@ -36,7 +37,6 @@ use aptos_types::{ }, transaction::Version, }; -use executor_types::in_memory_state_calculator::InMemoryStateCalculator; use once_cell::sync::Lazy; use schemadb::{ReadOptions, SchemaBatch, DB}; use std::{ diff --git a/storage/aptosdb/src/test_helper.rs b/storage/aptosdb/src/test_helper.rs index bf561c8714023..dde18a722f625 100644 --- a/storage/aptosdb/src/test_helper.rs +++ b/storage/aptosdb/src/test_helper.rs @@ -9,6 +9,7 @@ use crate::{ use aptos_types::ledger_info::generate_ledger_info_with_sig; use aptos_crypto::hash::{CryptoHash, EventAccumulatorHasher, TransactionAccumulatorHasher}; +use aptos_executor_types::ProofReader; use aptos_jellyfish_merkle::node_type::{Node, NodeKey}; use aptos_temppath::TempPath; use aptos_types::{ @@ -17,7 +18,6 @@ use aptos_types::{ proof::accumulator::InMemoryAccumulator, proptest_types::{AccountInfoUniverse, BlockGen}, }; -use executor_types::ProofReader; use proptest::sample::Index; use proptest::{collection::vec, prelude::*}; use scratchpad::SparseMerkleTree; diff --git a/storage/backup/backup-cli/Cargo.toml b/storage/backup/backup-cli/Cargo.toml index ba5ed0aaa3ca6..b30808f0a8f8c 100644 --- a/storage/backup/backup-cli/Cargo.toml +++ b/storage/backup/backup-cli/Cargo.toml @@ -16,6 +16,9 @@ rust-version = { workspace = true } anyhow = { workspace = true } aptos-config = { workspace = true } aptos-crypto = { workspace = true } +aptos-executor = { workspace = true } +aptos-executor-test-helpers = { workspace = true } +aptos-executor-types = { workspace = true } aptos-infallible = { workspace = true } aptos-jellyfish-merkle = { workspace = true } aptos-logger = { workspace = true } @@ -28,11 +31,10 @@ async-trait = { workspace = true } bcs = { workspace = true } bytes = { workspace = true } clap = { workspace = true } -executor = { workspace = true } -executor-test-helpers = { workspace = true } -executor-types = { workspace = true } futures = { workspace = true } itertools = { workspace = true } +move-binary-format = { workspace = true } +move-bytecode-verifier = { workspace = true } num_cpus = { workspace = true } once_cell = { workspace = true } pin-project = { workspace = true } @@ -49,11 +51,11 @@ tokio-stream = { workspace = true } tokio-util = { workspace = true } [dev-dependencies] +aptos-backup-service = { workspace = true } aptos-config = { workspace = true } +aptos-executor-test-helpers = { workspace = true } aptos-proptest-helpers = { workspace = true } aptosdb = { workspace = true } -backup-service = { workspace = true } -executor-test-helpers = { workspace = true } proptest = { workspace = true } storage-interface = { workspace = true } warp = { workspace = true } 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 7cd5dbba9c1bf..8f69e8ae1f00c 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 @@ -15,6 +15,7 @@ use crate::{ ConcurrentDownloadsOpt, GlobalBackupOpt, GlobalRestoreOpt, RocksdbOpt, TrustedWaypointOpt, }, }; +use aptos_backup_service::start_backup_service; use aptos_config::utils::get_available_port; use aptos_temppath::TempPath; use aptos_types::aggregate_signature::AggregateSignature; @@ -24,7 +25,6 @@ use aptos_types::{ waypoint::Waypoint, }; use aptosdb::AptosDB; -use backup_service::start_backup_service; use proptest::{collection::vec, prelude::*}; use std::{ convert::TryInto, diff --git a/storage/backup/backup-cli/src/backup_types/state_snapshot/restore.rs b/storage/backup/backup-cli/src/backup_types/state_snapshot/restore.rs index 71f1ca56b6c12..81d44adf7455f 100644 --- a/storage/backup/backup-cli/src/backup_types/state_snapshot/restore.rs +++ b/storage/backup/backup-cli/src/backup_types/state_snapshot/restore.rs @@ -26,13 +26,17 @@ use anyhow::{anyhow, ensure, Result}; use aptos_infallible::Mutex; use aptos_logger::prelude::*; use aptos_types::{ + access_path::Path, ledger_info::LedgerInfoWithSignatures, proof::TransactionInfoWithProof, state_store::{state_key::StateKey, state_value::StateValue}, transaction::Version, }; +use aptos_vm::move_vm_ext::verifier_config; use clap::Parser; use futures::{stream, TryStreamExt}; +use move_binary_format::CompiledModule; +use move_bytecode_verifier::verify_module_with_config; use std::sync::Arc; use storage_interface::StateSnapshotReceiver; use tokio::time::Instant; @@ -43,6 +47,8 @@ pub struct StateSnapshotRestoreOpt { pub manifest_handle: FileHandle, #[clap(long = "state-into-version")] pub version: Version, + #[clap(long)] + pub validate_modules: bool, } pub struct StateSnapshotRestoreController { @@ -56,6 +62,7 @@ pub struct StateSnapshotRestoreController { target_version: Version, epoch_history: Option>, concurrent_downloads: usize, + validate_modules: bool, } impl StateSnapshotRestoreController { @@ -73,6 +80,7 @@ impl StateSnapshotRestoreController { target_version: global_opt.target_version, epoch_history, concurrent_downloads: global_opt.concurrent_downloads, + validate_modules: opt.validate_modules, } } @@ -186,6 +194,9 @@ impl StateSnapshotRestoreController { .with_label_values(&["add_state_chunk"]) .start_timer(); let receiver = receiver.clone(); + if self.validate_modules { + Self::validate_modules(&blobs); + } tokio::task::spawn_blocking(move || { receiver.lock().as_mut().unwrap().add_chunk(blobs, proof) }) @@ -207,6 +218,23 @@ impl StateSnapshotRestoreController { Ok(()) } + fn validate_modules(blob: &[(StateKey, StateValue)]) { + let config = verifier_config(); + for (key, value) in blob { + if let StateKey::AccessPath(p) = key { + if let Path::Code(module_id) = p.get_path() { + if let Ok(module) = CompiledModule::deserialize(value.bytes()) { + if let Err(err) = verify_module_with_config(&config, &module) { + error!("Module {:?} failed validation: {:?}", module_id, err); + } + } else { + error!("Module {:?} failed to deserialize", module_id); + } + } + } + } + } + async fn read_state_value( storage: &Arc, file_handle: FileHandle, 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 2da2af0a1048b..64e56b89aabe6 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 @@ -76,6 +76,7 @@ fn end_to_end() { StateSnapshotRestoreOpt { manifest_handle, version, + validate_modules: false, }, GlobalRestoreOpt { dry_run: false, diff --git a/storage/backup/backup-cli/src/backup_types/tests.rs b/storage/backup/backup-cli/src/backup_types/tests.rs index ff09d6d57b473..c0557190c24e5 100644 --- a/storage/backup/backup-cli/src/backup_types/tests.rs +++ b/storage/backup/backup-cli/src/backup_types/tests.rs @@ -20,10 +20,10 @@ use crate::{ RocksdbOpt, TrustedWaypointOpt, }, }; +use aptos_executor_test_helpers::integration_test_impl::test_execution_with_storage_impl; use aptos_temppath::TempPath; use aptos_types::transaction::Version; use aptosdb::AptosDB; -use executor_test_helpers::integration_test_impl::test_execution_with_storage_impl; use proptest::{prelude::*, sample::Index}; use std::{convert::TryInto, sync::Arc}; use storage_interface::DbReader; @@ -133,6 +133,7 @@ fn test_end_to_end_impl(d: TestData) { StateSnapshotRestoreOpt { manifest_handle: state_snapshot_manifest.unwrap(), version, + validate_modules: false, }, global_restore_opt.clone(), Arc::clone(&store), @@ -153,6 +154,7 @@ fn test_end_to_end_impl(d: TestData) { global_restore_opt, store, None, /* epoch_history */ + vec![], ) .run(), ) 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 973e83d223c9f..8590a3c99465b 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,8 @@ use crate::{ }, }; use anyhow::{anyhow, ensure, Result}; +use aptos_executor::chunk_executor::ChunkExecutor; +use aptos_executor_types::TransactionReplayer; use aptos_logger::prelude::*; use aptos_types::write_set::WriteSet; use aptos_types::{ @@ -32,8 +34,6 @@ use aptos_types::{ use aptos_vm::AptosVM; use aptosdb::backup::restore_handler::RestoreHandler; use clap::Parser; -use executor::chunk_executor::ChunkExecutor; -use executor_types::TransactionReplayer; use futures::{ future, future::TryFutureExt, @@ -41,9 +41,10 @@ use futures::{ stream::{Peekable, Stream, TryStreamExt}, StreamExt, }; -use itertools::zip_eq; +use itertools::{izip, Itertools}; use std::{ cmp::{max, min}, + collections::BTreeSet, pin::Pin, sync::Arc, time::Instant, @@ -82,6 +83,7 @@ struct LoadedChunk { pub txns: Vec, pub txn_infos: Vec, pub event_vecs: Vec>, + pub write_sets: Vec, pub range_proof: TransactionAccumulatorRangeProof, pub ledger_info: LedgerInfoWithSignatures, } @@ -96,13 +98,15 @@ impl LoadedChunk { let mut txns = Vec::new(); let mut txn_infos = Vec::new(); let mut event_vecs = Vec::new(); + let mut write_sets = Vec::new(); while let Some(record_bytes) = file.read_record_bytes().await? { - let (txn, txn_info, events, _write_set): (_, _, _, WriteSet) = + let (txn, txn_info, events, write_set): (_, _, _, WriteSet) = bcs::from_bytes(&record_bytes)?; txns.push(txn); txn_infos.push(txn_info); event_vecs.push(events); + write_sets.push(write_set); } ensure!( @@ -145,6 +149,7 @@ impl LoadedChunk { event_vecs, range_proof, ledger_info, + write_sets, }) } } @@ -155,6 +160,7 @@ impl TransactionRestoreController { global_opt: GlobalRestoreOptions, storage: Arc, epoch_history: Option>, + txns_to_skip: Vec, ) -> Self { let inner = TransactionRestoreBatchController::new( global_opt, @@ -162,6 +168,7 @@ impl TransactionRestoreController { vec![opt.manifest_handle], opt.replay_from_version, epoch_history, + txns_to_skip.into_iter().collect(), ); Self { inner } @@ -181,6 +188,7 @@ pub struct TransactionRestoreBatchController { manifest_handles: Vec, replay_from_version: Option, epoch_history: Option>, + txns_to_skip: Arc>, } impl TransactionRestoreBatchController { @@ -190,6 +198,7 @@ impl TransactionRestoreBatchController { manifest_handles: Vec, replay_from_version: Option, epoch_history: Option>, + txns_to_skip: Vec, ) -> Self { Self { global_opt, @@ -197,6 +206,7 @@ impl TransactionRestoreBatchController { manifest_handles, replay_from_version, epoch_history, + txns_to_skip: Arc::new(txns_to_skip.into_iter().collect()), } } @@ -325,7 +335,11 @@ impl TransactionRestoreBatchController { global_first_version: Version, loaded_chunk_stream: impl Stream> + Unpin, restore_handler: &RestoreHandler, - ) -> Result>>> { + ) -> Result< + Option< + impl Stream)>>, + >, + > { let next_expected_version = self .global_opt .run_mode @@ -359,6 +373,7 @@ impl TransactionRestoreBatchController { mut txns, mut txn_infos, mut event_vecs, + mut write_sets, range_proof: _, ledger_info: _, } = chunk; @@ -368,6 +383,7 @@ impl TransactionRestoreBatchController { txns.drain(num_to_keep..); txn_infos.drain(num_to_keep..); event_vecs.drain(num_to_keep..); + write_sets.drain(num_to_keep..); last_version = target_version; } @@ -377,6 +393,7 @@ impl TransactionRestoreBatchController { let txns_to_save: Vec<_> = txns.drain(..num_to_save).collect(); let txn_infos_to_save: Vec<_> = txn_infos.drain(..num_to_save).collect(); let event_vecs_to_save: Vec<_> = event_vecs.drain(..num_to_save).collect(); + write_sets.drain(..num_to_save); tokio::task::spawn_blocking(move || { restore_handler.save_transactions( @@ -398,7 +415,9 @@ impl TransactionRestoreBatchController { } Ok(stream::iter( - zip_eq(txns, txn_infos).into_iter().map(Result::<_>::Ok), + izip!(txns, txn_infos, write_sets, event_vecs) + .into_iter() + .map(Result::<_>::Ok), )) }) }) @@ -422,7 +441,9 @@ impl TransactionRestoreBatchController { async fn replay_transactions( &self, restore_handler: &RestoreHandler, - txns_to_execute_stream: impl Stream>, + txns_to_execute_stream: impl Stream< + Item = Result<(Transaction, TransactionInfo, WriteSet, Vec)>, + >, ) -> Result<()> { let first_version = self.replay_from_version.unwrap(); restore_handler.reset_state_store(); @@ -434,15 +455,20 @@ impl TransactionRestoreBatchController { .try_chunks(BATCH_SIZE) .err_into::() .map_ok(|chunk| { - let (txns, txn_infos): (Vec<_>, Vec<_>) = chunk.into_iter().unzip(); + let (txns, txn_infos, write_sets, events): (Vec<_>, Vec<_>, Vec<_>, Vec<_>) = + chunk.into_iter().multiunzip(); let chunk_replayer = chunk_replayer.clone(); + let txns_to_skip = self.txns_to_skip.clone(); + async move { let _timer = OTHER_TIMERS_SECONDS .with_label_values(&["replay_txn_chunk"]) .start_timer(); - tokio::task::spawn_blocking(move || chunk_replayer.replay(txns, txn_infos)) - .err_into::() - .await + tokio::task::spawn_blocking(move || { + chunk_replayer.replay(txns, txn_infos, write_sets, events, txns_to_skip) + }) + .err_into::() + .await } }) .try_buffered_x(self.global_opt.concurrent_downloads, 1) 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 579e9d47a9a5f..1d071f94a83f5 100644 --- a/storage/backup/backup-cli/src/backup_types/transaction/tests.rs +++ b/storage/backup/backup-cli/src/backup_types/transaction/tests.rs @@ -90,6 +90,7 @@ fn end_to_end() { .unwrap(), store, None, /* epoch_history */ + vec![], ) .run(), ) diff --git a/storage/backup/backup-cli/src/bin/db-restore.rs b/storage/backup/backup-cli/src/bin/db-restore.rs index c021147ce1320..1d05552a008e8 100644 --- a/storage/backup/backup-cli/src/bin/db-restore.rs +++ b/storage/backup/backup-cli/src/bin/db-restore.rs @@ -92,6 +92,7 @@ async fn main_impl() -> Result<()> { global_opt, storage.init_storage().await?, None, /* epoch_history */ + vec![], ) .run() .await?; diff --git a/storage/backup/backup-cli/src/bin/replay-verify.rs b/storage/backup/backup-cli/src/bin/replay-verify.rs index 358bfac52ad92..7f5293301f0f9 100644 --- a/storage/backup/backup-cli/src/bin/replay-verify.rs +++ b/storage/backup/backup-cli/src/bin/replay-verify.rs @@ -46,6 +46,14 @@ struct Opt { in the backup). [Defaults to the latest version available] " )] end_version: Option, + #[clap(long)] + validate_modules: bool, + #[clap( + long, + multiple = true, + help = "Skip the execution for txns that are known to break compatibility." + )] + txns_to_skip: Vec, } #[tokio::main] @@ -79,6 +87,8 @@ async fn main_impl() -> Result<()> { restore_handler, opt.start_version.unwrap_or(0), opt.end_version.unwrap_or(Version::MAX), + opt.validate_modules, + opt.txns_to_skip, )? .run() .await diff --git a/storage/backup/backup-cli/src/coordinators/replay_verify.rs b/storage/backup/backup-cli/src/coordinators/replay_verify.rs index e2fad8972cd7d..32a83dc6a1b54 100644 --- a/storage/backup/backup-cli/src/coordinators/replay_verify.rs +++ b/storage/backup/backup-cli/src/coordinators/replay_verify.rs @@ -27,6 +27,8 @@ pub struct ReplayVerifyCoordinator { restore_handler: RestoreHandler, start_version: Version, end_version: Version, + validate_modules: bool, + txns_to_skip: Vec, } impl ReplayVerifyCoordinator { @@ -39,6 +41,8 @@ impl ReplayVerifyCoordinator { restore_handler: RestoreHandler, start_version: Version, end_version: Version, + validate_modules: bool, + txns_to_skip: Vec, ) -> Result { Ok(Self { storage, @@ -49,6 +53,8 @@ impl ReplayVerifyCoordinator { restore_handler, start_version, end_version, + validate_modules, + txns_to_skip, }) } @@ -112,6 +118,7 @@ impl ReplayVerifyCoordinator { StateSnapshotRestoreOpt { manifest_handle: backup.manifest, version: backup.version, + validate_modules: self.validate_modules, }, global_opt.clone(), Arc::clone(&self.storage), @@ -128,6 +135,7 @@ impl ReplayVerifyCoordinator { txn_manifests, Some(replay_transactions_from_version), /* replay_from_version */ None, /* epoch_history */ + self.txns_to_skip, ) .run() .await?; diff --git a/storage/backup/backup-cli/src/coordinators/restore.rs b/storage/backup/backup-cli/src/coordinators/restore.rs index 4cabae6c37709..8b51e6e298394 100644 --- a/storage/backup/backup-cli/src/coordinators/restore.rs +++ b/storage/backup/backup-cli/src/coordinators/restore.rs @@ -170,6 +170,7 @@ impl RestoreCoordinator { StateSnapshotRestoreOpt { manifest_handle: state_snapshot_backup.manifest, version, + validate_modules: false, }, self.global_opt.clone(), Arc::clone(&self.storage), @@ -185,6 +186,7 @@ impl RestoreCoordinator { txn_manifests, Some(version + 1), epoch_history, + vec![], ) .run() .await?; diff --git a/storage/backup/backup-cli/src/coordinators/verify.rs b/storage/backup/backup-cli/src/coordinators/verify.rs index 2da452e82ff75..e9765f5679188 100644 --- a/storage/backup/backup-cli/src/coordinators/verify.rs +++ b/storage/backup/backup-cli/src/coordinators/verify.rs @@ -100,6 +100,7 @@ impl VerifyCoordinator { StateSnapshotRestoreOpt { manifest_handle: backup.manifest, version: backup.version, + validate_modules: false, }, global_opt.clone(), Arc::clone(&self.storage), @@ -116,6 +117,7 @@ impl VerifyCoordinator { txn_manifests, None, /* replay_from_version */ Some(epoch_history), + vec![], ) .run() .await?; diff --git a/storage/backup/backup-cli/src/utils/test_utils.rs b/storage/backup/backup-cli/src/utils/test_utils.rs index 25042309b504f..98e352d1f86d8 100644 --- a/storage/backup/backup-cli/src/utils/test_utils.rs +++ b/storage/backup/backup-cli/src/utils/test_utils.rs @@ -1,6 +1,7 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 +use aptos_backup_service::start_backup_service; use aptos_config::utils::get_available_port; use aptos_proptest_helpers::ValueGenerator; use aptos_temppath::TempPath; @@ -12,7 +13,6 @@ use aptosdb::{ test_helper::{arb_blocks_to_commit, update_in_memory_state}, AptosDB, }; -use backup_service::start_backup_service; 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 2384aad79fd9d..3f6c3f5321739 100644 --- a/storage/backup/backup-service/Cargo.toml +++ b/storage/backup/backup-service/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "backup-service" +name = "aptos-backup-service" description = "Backup service" version = "0.1.0" diff --git a/testsuite/aptos-fuzzer/Cargo.toml b/testsuite/aptos-fuzzer/Cargo.toml index af9201aa1c801..66377f4be0823 100644 --- a/testsuite/aptos-fuzzer/Cargo.toml +++ b/testsuite/aptos-fuzzer/Cargo.toml @@ -15,7 +15,11 @@ rust-version = { workspace = true } [dependencies] anyhow = { workspace = true } 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-executor = { workspace = true, features = ["fuzzing"] } +aptos-executor-types = { workspace = true, features = ["fuzzing"] } aptos-jellyfish-merkle = { workspace = true, features = ["fuzzing"] } aptos-mempool = { workspace = true } aptos-proptest-helpers = { workspace = true } @@ -24,10 +28,6 @@ aptos-vault-client = { workspace = true, features = ["fuzzing"] } aptosdb = { workspace = true, features = ["fuzzing"] } bcs = { workspace = true } byteorder = { workspace = true } -consensus = { workspace = true, features = ["fuzzing"] } -consensus-types = { workspace = true, features = ["fuzzing"] } -executor = { workspace = true, features = ["fuzzing"] } -executor-types = { workspace = true, features = ["fuzzing"] } hex = { workspace = true } language-e2e-tests = { workspace = true } move-binary-format = { workspace = true, features = ["fuzzing"] } diff --git a/testsuite/aptos-fuzzer/src/fuzz_targets/consensus.rs b/testsuite/aptos-fuzzer/src/fuzz_targets/consensus.rs index a09494398927d..73faca4ab78c7 100644 --- a/testsuite/aptos-fuzzer/src/fuzz_targets/consensus.rs +++ b/testsuite/aptos-fuzzer/src/fuzz_targets/consensus.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use crate::FuzzTargetImpl; +use aptos_consensus::round_manager_fuzzing::{fuzz_proposal, generate_corpus_proposal}; use aptos_proptest_helpers::ValueGenerator; -use consensus::round_manager_fuzzing::{fuzz_proposal, generate_corpus_proposal}; #[derive(Clone, Debug, Default)] pub struct ConsensusProposal; diff --git a/testsuite/aptos-fuzzer/src/fuzz_targets/executor.rs b/testsuite/aptos-fuzzer/src/fuzz_targets/executor.rs index 5c076d09f5550..e307d69183a6b 100644 --- a/testsuite/aptos-fuzzer/src/fuzz_targets/executor.rs +++ b/testsuite/aptos-fuzzer/src/fuzz_targets/executor.rs @@ -3,9 +3,9 @@ use crate::{corpus_from_strategy, fuzz_data_to_value, FuzzTargetImpl}; use aptos_crypto::HashValue; +use aptos_executor::fuzzing::fuzz_execute_and_commit_blocks; use aptos_proptest_helpers::ValueGenerator; use aptos_types::{ledger_info::LedgerInfoWithSignatures, transaction::Transaction}; -use executor::fuzzing::fuzz_execute_and_commit_blocks; use proptest::{collection::vec, prelude::*}; #[derive(Clone, Debug, Default)] diff --git a/testsuite/forge-cli/Cargo.toml b/testsuite/forge-cli/Cargo.toml index 30cdacf28a037..867b8ede07787 100644 --- a/testsuite/forge-cli/Cargo.toml +++ b/testsuite/forge-cli/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "forge-cli" +name = "aptos-forge-cli" description = "Aptos end to end test framework CLI" version = "0.0.0" @@ -14,15 +14,15 @@ rust-version = { workspace = true } [dependencies] anyhow = { workspace = true } +aptos-cached-packages = { workspace = true } aptos-config = { workspace = true } +aptos-forge = { workspace = true } +aptos-framework = { workspace = true } aptos-global-constants = { workspace = true } aptos-logger = { workspace = true } aptos-rest-client = { workspace = true } aptos-sdk = { workspace = true } async-trait = { workspace = true } -cached-packages = { workspace = true } -forge = { workspace = true } -framework = { workspace = true } serde_yaml = { workspace = true } structopt = { workspace = true } testcases = { workspace = true } diff --git a/testsuite/forge-cli/src/main.rs b/testsuite/forge-cli/src/main.rs index be276f8ae2b18..e1bf6617ead8e 100644 --- a/testsuite/forge-cli/src/main.rs +++ b/testsuite/forge-cli/src/main.rs @@ -3,12 +3,12 @@ use anyhow::{format_err, Context, Result}; use aptos_config::config::ConsensusConfig; +use aptos_forge::success_criteria::{LatencyType, StateProgressThreshold, SuccessCriteria}; +use aptos_forge::system_metrics::{MetricsThreshold, SystemMetricsThreshold}; +use aptos_forge::{ForgeConfig, Options, *}; use aptos_logger::Level; use aptos_rest_client::Client as RestClient; use aptos_sdk::{move_types::account_address::AccountAddress, transaction_builder::aptos_stdlib}; -use forge::success_criteria::{LatencyType, StateProgressThreshold, SuccessCriteria}; -use forge::system_metrics::{MetricsThreshold, SystemMetricsThreshold}; -use forge::{ForgeConfig, Options, *}; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::{env, num::NonZeroUsize, process, thread, time::Duration}; @@ -399,7 +399,7 @@ fn get_test_suite(suite_name: &str, duration: Duration) -> Result ForgeConfig<'static> { ForgeConfig::default() .with_admin_tests(vec![&GetMetadata]) - .with_genesis_module_bundle(cached_packages::head_release_bundle().clone()) + .with_genesis_module_bundle(aptos_cached_packages::head_release_bundle().clone()) .with_aptos_tests(vec![&RunForever]) } @@ -408,7 +408,7 @@ fn local_test_suite() -> ForgeConfig<'static> { .with_aptos_tests(vec![&FundAccount, &TransferCoins]) .with_admin_tests(vec![&GetMetadata]) .with_network_tests(vec![&RestartValidator, &EmitTransaction]) - .with_genesis_module_bundle(cached_packages::head_release_bundle().clone()) + .with_genesis_module_bundle(aptos_cached_packages::head_release_bundle().clone()) } fn k8s_test_suite() -> ForgeConfig<'static> { diff --git a/testsuite/forge.py b/testsuite/forge.py index 9c280d8de0286..0f06fdc406a2c 100644 --- a/testsuite/forge.py +++ b/testsuite/forge.py @@ -969,7 +969,7 @@ def create_forge_command( forge_args.extend( [ "-p", - "forge-cli", + "aptos-forge-cli", "--", ] ) diff --git a/testsuite/forge/Cargo.toml b/testsuite/forge/Cargo.toml index 4ec84b7a3dc0f..5240d4dd9a5a3 100644 --- a/testsuite/forge/Cargo.toml +++ b/testsuite/forge/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "forge" +name = "aptos-forge" description = "Aptos end to end test framework" version = "0.0.0" @@ -16,7 +16,9 @@ rust-version = { workspace = true } again = { workspace = true } anyhow = { workspace = true, features = ["backtrace"] } aptos = { workspace = true } +aptos-cached-packages = { workspace = true } aptos-config = { workspace = true } +aptos-framework = { workspace = true } aptos-genesis = { workspace = true } aptos-global-constants = { workspace = true } aptos-infallible = { workspace = true } @@ -27,10 +29,8 @@ aptos-sdk = { workspace = true } aptos-secure-storage = { workspace = true } aptosdb = { workspace = true } async-trait = { workspace = true } -cached-packages = { workspace = true } chrono = { workspace = true } either = { workspace = true } -framework = { workspace = true } futures = { workspace = true } hex = { workspace = true } hyper = { workspace = true } diff --git a/testsuite/forge/src/backend/local/mod.rs b/testsuite/forge/src/backend/local/mod.rs index 5429c079d4b70..1d40b6f88837c 100644 --- a/testsuite/forge/src/backend/local/mod.rs +++ b/testsuite/forge/src/backend/local/mod.rs @@ -4,9 +4,9 @@ use crate::{Factory, GenesisConfig, GenesisConfigFn, NodeConfigFn, Result, Swarm, Version}; use anyhow::{bail, Context}; use aptos_config::config::NodeConfig; +use aptos_framework::ReleaseBundle; use aptos_genesis::builder::{InitConfigFn, InitGenesisConfigFn}; use aptos_infallible::Mutex; -use framework::ReleaseBundle; use rand::rngs::StdRng; use std::time::Duration; use std::{ diff --git a/testsuite/forge/src/backend/local/swarm.rs b/testsuite/forge/src/backend/local/swarm.rs index 7b4e4288ceb5d..14a6dde3b4efe 100644 --- a/testsuite/forge/src/backend/local/swarm.rs +++ b/testsuite/forge/src/backend/local/swarm.rs @@ -11,6 +11,7 @@ use aptos_config::{ keys::ConfigKey, network_id::NetworkId, }; +use aptos_framework::ReleaseBundle; use aptos_genesis::builder::{FullnodeNodeConfig, InitConfigFn, InitGenesisConfigFn}; use aptos_infallible::Mutex; use aptos_logger::{info, warn}; @@ -21,7 +22,6 @@ use aptos_sdk::{ PeerId, }, }; -use framework::ReleaseBundle; use prometheus_http_query::response::PromqlResult; use std::{ collections::HashMap, @@ -128,7 +128,8 @@ impl LocalSwarm { let (root_key, genesis, genesis_waypoint, validators) = aptos_genesis::builder::Builder::new( &dir_actual, - genesis_framework.unwrap_or_else(|| cached_packages::head_release_bundle().clone()), + genesis_framework + .unwrap_or_else(|| aptos_cached_packages::head_release_bundle().clone()), )? .with_num_validators(number_of_validators) .with_init_config(Some(Arc::new( diff --git a/testsuite/forge/src/interface/aptos.rs b/testsuite/forge/src/interface/aptos.rs index be967310a804a..f00dac52ab732 100644 --- a/testsuite/forge/src/interface/aptos.rs +++ b/testsuite/forge/src/interface/aptos.rs @@ -3,6 +3,7 @@ use super::Test; use crate::{CoreContext, Result, TestReport}; +use aptos_cached_packages::aptos_stdlib; use aptos_logger::info; use aptos_rest_client::{Client as RestClient, PendingTransaction, State, Transaction}; use aptos_sdk::{ @@ -19,7 +20,6 @@ use aptos_sdk::{ LocalAccount, }, }; -use cached_packages::aptos_stdlib; use rand::{rngs::OsRng, Rng, SeedableRng}; use reqwest::Url; diff --git a/testsuite/forge/src/interface/mod.rs b/testsuite/forge/src/interface/mod.rs index 03b6a90932b6d..ee394dbbeafbb 100644 --- a/testsuite/forge/src/interface/mod.rs +++ b/testsuite/forge/src/interface/mod.rs @@ -20,8 +20,8 @@ pub use node::*; mod chain_info; pub mod system_metrics; +use aptos_framework::ReleaseBundle; pub use chain_info::*; -use framework::ReleaseBundle; /// A wrapper around a usize in order to represent an opaque version of a Node. /// diff --git a/testsuite/forge/src/runner.rs b/testsuite/forge/src/runner.rs index 7fface3382fd4..631bb394dfa54 100644 --- a/testsuite/forge/src/runner.rs +++ b/testsuite/forge/src/runner.rs @@ -17,7 +17,7 @@ use tokio::runtime::Runtime; // TODO going to remove random seed once cluster deployment supports re-run genesis use crate::success_criteria::SuccessCriteria; use crate::system_metrics::{MetricsThreshold, SystemMetricsThreshold}; -use framework::ReleaseBundle; +use aptos_framework::ReleaseBundle; use rand::rngs::OsRng; #[derive(Debug, StructOpt)] diff --git a/testsuite/forge_test.py b/testsuite/forge_test.py index 7f3ec7f9dd00f..c6d4548273c6f 100644 --- a/testsuite/forge_test.py +++ b/testsuite/forge_test.py @@ -330,7 +330,7 @@ def testLocalRunner(self) -> None: "run", "--cargo-arg", "-p", - "forge-cli", + "aptos-forge-cli", "--", "--suite", "banana", diff --git a/testsuite/generate-format/Cargo.toml b/testsuite/generate-format/Cargo.toml index 7e3e5cdeb0908..bc8694367e408 100644 --- a/testsuite/generate-format/Cargo.toml +++ b/testsuite/generate-format/Cargo.toml @@ -15,12 +15,12 @@ rust-version = { workspace = true } [dependencies] aptos-api-types = { workspace = true } aptos-config = { workspace = true } +aptos-consensus = { workspace = true, features = ["fuzzing"] } +aptos-consensus-types = { workspace = true } aptos-crypto = { workspace = true } aptos-crypto-derive = { workspace = true } aptos-types = { workspace = true } bcs = { workspace = true } -consensus = { workspace = true, features = ["fuzzing"] } -consensus-types = { workspace = true } move-core-types = { workspace = true, features = ["fuzzing"] } network = { workspace = true } rand = { workspace = true } diff --git a/testsuite/generate-format/src/consensus.rs b/testsuite/generate-format/src/consensus.rs index e847b631572b6..d5743c44b180b 100644 --- a/testsuite/generate-format/src/consensus.rs +++ b/testsuite/generate-format/src/consensus.rs @@ -58,7 +58,7 @@ pub fn get_registry() -> Result { trace_crypto_values(&mut tracer, &mut samples)?; tracer.trace_value( &mut samples, - &consensus_types::block::Block::make_genesis_block(), + &aptos_consensus_types::block::Block::make_genesis_block(), )?; tracer.trace_value(&mut samples, &event::EventKey::random())?; @@ -74,10 +74,10 @@ pub fn get_registry() -> Result { tracer.trace_type::(&samples)?; tracer.trace_type::(&samples)?; - tracer.trace_type::(&samples)?; - tracer.trace_type::(&samples)?; - tracer.trace_type::(&samples)?; - tracer.trace_type::(&samples)?; + tracer.trace_type::(&samples)?; + tracer.trace_type::(&samples)?; + tracer.trace_type::(&samples)?; + tracer.trace_type::(&samples)?; tracer.registry() } diff --git a/testsuite/generate-format/tests/staged/consensus.yaml b/testsuite/generate-format/tests/staged/consensus.yaml index 805544c81882c..1c8b1ec85fced 100644 --- a/testsuite/generate-format/tests/staged/consensus.yaml +++ b/testsuite/generate-format/tests/staged/consensus.yaml @@ -265,6 +265,10 @@ LedgerInfoWithV0: TYPENAME: LedgerInfo - signatures: TYPENAME: AggregateSignature +LogicalTime: + STRUCT: + - epoch: U64 + - round: U64 Module: STRUCT: - code: BYTES @@ -290,6 +294,21 @@ Payload: NEWTYPE: SEQ: TYPENAME: SignedTransaction + 1: + InQuorumStore: + NEWTYPE: + TYPENAME: ProofWithData +ProofOfStore: + STRUCT: + - info: + TYPENAME: SignedDigestInfo + - multi_signature: + TYPENAME: AggregateSignature +ProofWithData: + STRUCT: + - proofs: + SEQ: + TYPENAME: ProofOfStore ProposalMsg: STRUCT: - proposal: @@ -327,6 +346,14 @@ Script: TYPENAME: TransactionArgument Signature: NEWTYPESTRUCT: BYTES +SignedDigestInfo: + STRUCT: + - digest: + TYPENAME: HashValue + - expiration: + TYPENAME: LogicalTime + - num_txns: U64 + - num_bytes: U64 SignedTransaction: STRUCT: - raw_txn: diff --git a/testsuite/smoke-test/Cargo.toml b/testsuite/smoke-test/Cargo.toml index ea41ff6e40611..65c7a451ac07f 100644 --- a/testsuite/smoke-test/Cargo.toml +++ b/testsuite/smoke-test/Cargo.toml @@ -16,10 +16,14 @@ rust-version = { workspace = true } anyhow = { workspace = true } aptos = { workspace = true, features = ["fuzzing"] } aptos-bitvec = { path = "../../crates/aptos-bitvec" } +aptos-cached-packages = { workspace = true } aptos-config = { workspace = true } +aptos-consensus = { workspace = true } aptos-crypto = { workspace = true } aptos-debugger = { workspace = true } aptos-faucet = { workspace = true } +aptos-forge = { workspace = true } +aptos-framework = { workspace = true } aptos-gas = { workspace = true, features = ["testing"] } aptos-global-constants = { workspace = true } aptos-indexer = { workspace = true } @@ -33,11 +37,7 @@ aptos-types = { workspace = true } aptos-vm = { workspace = true } async-trait = { workspace = true } bcs = { workspace = true } -cached-packages = { workspace = true } -consensus = { workspace = true } diesel = { workspace = true } -forge = { workspace = true } -framework = { workspace = true } hex = { workspace = true } move-core-types = { workspace = true } proptest = { workspace = true } diff --git a/testsuite/smoke-test/src/aptos/error_report.rs b/testsuite/smoke-test/src/aptos/error_report.rs index 114acf26f0028..66928881d4876 100644 --- a/testsuite/smoke-test/src/aptos/error_report.rs +++ b/testsuite/smoke-test/src/aptos/error_report.rs @@ -1,12 +1,12 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 +use aptos_cached_packages::aptos_stdlib; +use aptos_forge::{AptosPublicInfo, Swarm}; use aptos_sdk::{transaction_builder::TransactionBuilder, types::LocalAccount}; use aptos_types::{ account_address::AccountAddress, account_config::aptos_test_root_address, chain_id::ChainId, }; -use cached_packages::aptos_stdlib; -use forge::{AptosPublicInfo, Swarm}; use crate::smoke_test_environment::new_local_swarm_with_aptos; diff --git a/testsuite/smoke-test/src/aptos/gas_check.rs b/testsuite/smoke-test/src/aptos/gas_check.rs index 29420ce9dfadd..5a6b94ebf73a3 100644 --- a/testsuite/smoke-test/src/aptos/gas_check.rs +++ b/testsuite/smoke-test/src/aptos/gas_check.rs @@ -1,8 +1,8 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 -use cached_packages::aptos_stdlib; -use forge::Swarm; +use aptos_cached_packages::aptos_stdlib; +use aptos_forge::Swarm; use std::time::Duration; use crate::smoke_test_environment::new_local_swarm_with_aptos; diff --git a/testsuite/smoke-test/src/aptos/mint_transfer.rs b/testsuite/smoke-test/src/aptos/mint_transfer.rs index 3fe9c3a728928..7a2373389614d 100644 --- a/testsuite/smoke-test/src/aptos/mint_transfer.rs +++ b/testsuite/smoke-test/src/aptos/mint_transfer.rs @@ -2,10 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 use crate::smoke_test_environment::new_local_swarm_with_aptos; +use aptos_cached_packages::aptos_stdlib; use aptos_debugger::AptosDebugger; +use aptos_forge::Swarm; use aptos_types::transaction::{ExecutionStatus, TransactionStatus}; -use cached_packages::aptos_stdlib; -use forge::Swarm; #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn test_mint_transfer() { diff --git a/testsuite/smoke-test/src/aptos/move_test_helpers.rs b/testsuite/smoke-test/src/aptos/move_test_helpers.rs index b111783a4b0df..68c4ba6c60610 100644 --- a/testsuite/smoke-test/src/aptos/move_test_helpers.rs +++ b/testsuite/smoke-test/src/aptos/move_test_helpers.rs @@ -4,9 +4,9 @@ //! Helpers for writing Move tests use anyhow::Result; +use aptos_forge::AptosPublicInfo; +use aptos_framework::{BuildOptions, BuiltPackage}; use aptos_sdk::transaction_builder::TransactionFactory; -use forge::AptosPublicInfo; -use framework::{BuildOptions, BuiltPackage}; use std::path::PathBuf; /// New style publishing via `code::publish_package` @@ -17,7 +17,7 @@ pub async fn publish_package( let package = BuiltPackage::build(move_dir, BuildOptions::default())?; let blobs = package.extract_code(); let metadata = package.extract_metadata()?; - let payload = cached_packages::aptos_stdlib::code_publish_package_txn( + let payload = aptos_cached_packages::aptos_stdlib::code_publish_package_txn( bcs::to_bytes(&metadata).expect("PackageMetadata has BCS"), blobs, ); diff --git a/testsuite/smoke-test/src/aptos/package_publish.rs b/testsuite/smoke-test/src/aptos/package_publish.rs index 25fff2ddad89a..0c788b8f615b4 100644 --- a/testsuite/smoke-test/src/aptos/package_publish.rs +++ b/testsuite/smoke-test/src/aptos/package_publish.rs @@ -3,7 +3,7 @@ use crate::aptos::move_test_helpers; use crate::smoke_test_environment::new_local_swarm_with_aptos; -use forge::Swarm; +use aptos_forge::Swarm; #[tokio::test] async fn test_package_publish() { diff --git a/testsuite/smoke-test/src/aptos_cli/move.rs b/testsuite/smoke-test/src/aptos_cli/move.rs index 9ca95df7c3160..8ccd9da8c1f89 100644 --- a/testsuite/smoke-test/src/aptos_cli/move.rs +++ b/testsuite/smoke-test/src/aptos_cli/move.rs @@ -4,8 +4,8 @@ use crate::smoke_test_environment::SwarmBuilder; use aptos::move_tool::MemberId; use aptos::test::CliTestFramework; +use aptos_framework::{BuildOptions, BuiltPackage}; use aptos_logger::info; -use framework::{BuildOptions, BuiltPackage}; use move_core_types::account_address::AccountAddress; use move_package::source_package::manifest_parser::parse_move_manifest_from_file; use std::collections::BTreeMap; diff --git a/testsuite/smoke-test/src/aptos_cli/validator.rs b/testsuite/smoke-test/src/aptos_cli/validator.rs index 722eeefe01589..91598361fda0a 100644 --- a/testsuite/smoke-test/src/aptos_cli/validator.rs +++ b/testsuite/smoke-test/src/aptos_cli/validator.rs @@ -10,6 +10,7 @@ use aptos::{account::create::DEFAULT_FUNDED_COINS, test::CliTestFramework}; use aptos_bitvec::BitVec; use aptos_crypto::ed25519::Ed25519PrivateKey; use aptos_crypto::{bls12381, x25519, ValidCryptoMaterialStringExt}; +use aptos_forge::{reconfig, LocalSwarm, NodeExt, Swarm, SwarmExt}; use aptos_genesis::config::HostAndPort; use aptos_keygen::KeyGen; use aptos_rest_client::{Client, State}; @@ -20,7 +21,6 @@ use aptos_types::on_chain_config::{ ProposerElectionType, ValidatorSet, }; use aptos_types::PeerId; -use forge::{reconfig, LocalSwarm, NodeExt, Swarm, SwarmExt}; use std::collections::HashMap; use std::convert::TryFrom; use std::fmt::Write; diff --git a/testsuite/smoke-test/src/client.rs b/testsuite/smoke-test/src/client.rs index 0ec2d6b8d4df9..f6b5d4f5a5bc3 100644 --- a/testsuite/smoke-test/src/client.rs +++ b/testsuite/smoke-test/src/client.rs @@ -7,8 +7,8 @@ use crate::{ assert_balance, check_create_mint_transfer, create_and_fund_account, transfer_coins, }, }; -use cached_packages::aptos_stdlib; -use forge::{NodeExt, Swarm}; +use aptos_cached_packages::aptos_stdlib; +use aptos_forge::{NodeExt, Swarm}; use std::time::{Duration, Instant}; #[tokio::test] diff --git a/testsuite/smoke-test/src/consensus/consensus_fault_tolerance.rs b/testsuite/smoke-test/src/consensus/consensus_fault_tolerance.rs index 7b7b1d135e56d..8990d51be3d60 100644 --- a/testsuite/smoke-test/src/consensus/consensus_fault_tolerance.rs +++ b/testsuite/smoke-test/src/consensus/consensus_fault_tolerance.rs @@ -13,13 +13,13 @@ use crate::{ smoke_test_environment::SwarmBuilder, test_utils::{create_and_fund_account, transfer_coins_non_blocking}, }; -use aptos_logger::info; -use forge::{ +use aptos_forge::{ test_utils::consensus_utils::{ no_failure_injection, test_consensus_fault_tolerance, FailPointFailureInjection, NodeState, }, LocalSwarm, Swarm, SwarmExt, }; +use aptos_logger::info; use rand::{self, rngs::SmallRng, Rng, SeedableRng}; pub async fn create_swarm(num_nodes: usize, max_block_txns: u64) -> LocalSwarm { diff --git a/testsuite/smoke-test/src/consensus/consensusdb_recovery.rs b/testsuite/smoke-test/src/consensus/consensusdb_recovery.rs index f64383632a781..e61bad3ccbe69 100644 --- a/testsuite/smoke-test/src/consensus/consensusdb_recovery.rs +++ b/testsuite/smoke-test/src/consensus/consensusdb_recovery.rs @@ -5,8 +5,8 @@ use crate::{ smoke_test_environment::new_local_swarm_with_aptos, test_utils::{assert_balance, create_and_fund_account, transfer_coins}, }; -use consensus::CONSENSUS_DB_NAME; -use forge::{HealthCheckError, NodeExt, Swarm}; +use aptos_consensus::CONSENSUS_DB_NAME; +use aptos_forge::{HealthCheckError, NodeExt, Swarm}; use std::{ fs, time::{Duration, Instant}, diff --git a/testsuite/smoke-test/src/full_nodes.rs b/testsuite/smoke-test/src/full_nodes.rs index 62415e674313a..ba981315d3f9b 100644 --- a/testsuite/smoke-test/src/full_nodes.rs +++ b/testsuite/smoke-test/src/full_nodes.rs @@ -7,8 +7,8 @@ use aptos_config::{ config::{DiscoveryMethod, NodeConfig, Peer, PeerRole, HANDSHAKE_VERSION}, network_id::NetworkId, }; +use aptos_forge::{LocalSwarm, NodeExt, Swarm, SwarmExt}; use aptos_types::network_address::{NetworkAddress, Protocol}; -use forge::{LocalSwarm, NodeExt, Swarm, SwarmExt}; use std::{ collections::HashSet, net::Ipv4Addr, diff --git a/testsuite/smoke-test/src/fullnode.rs b/testsuite/smoke-test/src/fullnode.rs index b866f65383609..047271fb8698b 100644 --- a/testsuite/smoke-test/src/fullnode.rs +++ b/testsuite/smoke-test/src/fullnode.rs @@ -4,13 +4,13 @@ use std::time::{Duration, Instant}; use anyhow::bail; +use aptos_cached_packages::aptos_stdlib; use aptos_config::config::NodeConfig; +use aptos_forge::NodeExt; +use aptos_forge::Result; +use aptos_forge::Swarm; use aptos_rest_client::Client as RestClient; use aptos_types::account_address::AccountAddress; -use cached_packages::aptos_stdlib; -use forge::NodeExt; -use forge::Result; -use forge::Swarm; use crate::smoke_test_environment::new_local_swarm_with_aptos; diff --git a/testsuite/smoke-test/src/genesis.rs b/testsuite/smoke-test/src/genesis.rs index 6c70a2e49bf0f..f8a95e4ab0258 100644 --- a/testsuite/smoke-test/src/genesis.rs +++ b/testsuite/smoke-test/src/genesis.rs @@ -10,10 +10,10 @@ use crate::{ }; use anyhow::anyhow; use aptos_config::config::NodeConfig; +use aptos_forge::{get_highest_synced_version, LocalNode, Node, NodeExt, SwarmExt, Validator}; use aptos_logger::prelude::*; use aptos_temppath::TempPath; use aptos_types::{transaction::Transaction, waypoint::Waypoint}; -use forge::{get_highest_synced_version, LocalNode, Node, NodeExt, SwarmExt, Validator}; use move_core_types::language_storage::CORE_CODE_ADDRESS; use regex::Regex; use std::time::Instant; diff --git a/testsuite/smoke-test/src/indexer.rs b/testsuite/smoke-test/src/indexer.rs index b0cb480de82cc..45f684f5d85fd 100644 --- a/testsuite/smoke-test/src/indexer.rs +++ b/testsuite/smoke-test/src/indexer.rs @@ -1,14 +1,14 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 +use aptos_cached_packages::aptos_stdlib::aptos_token_stdlib; +use aptos_forge::{AptosPublicInfo, Result, Swarm}; use aptos_indexer::{ database::{new_db_pool, PgDbPool, PgPoolConnection}, models::transactions::TransactionQuery, }; use aptos_sdk::types::LocalAccount; -use cached_packages::aptos_stdlib::aptos_token_stdlib; use diesel::RunQueryDsl; -use forge::{AptosPublicInfo, Result, Swarm}; use std::sync::Arc; pub fn wipe_database(conn: &mut PgPoolConnection) { diff --git a/testsuite/smoke-test/src/network.rs b/testsuite/smoke-test/src/network.rs index fad61dc1a75af..9dd07c0672d2d 100644 --- a/testsuite/smoke-test/src/network.rs +++ b/testsuite/smoke-test/src/network.rs @@ -10,10 +10,10 @@ use aptos_config::{ network_id::NetworkId, }; use aptos_crypto::{x25519, x25519::PrivateKey}; +use aptos_forge::{FullNode, NodeExt, Swarm}; use aptos_genesis::config::HostAndPort; use aptos_sdk::move_types::account_address::AccountAddress; use aptos_temppath::TempPath; -use forge::{FullNode, NodeExt, Swarm}; use std::{ collections::HashMap, path::Path, diff --git a/testsuite/smoke-test/src/rest_api.rs b/testsuite/smoke-test/src/rest_api.rs index 0145bec1aff9a..3a4ca4c402993 100644 --- a/testsuite/smoke-test/src/rest_api.rs +++ b/testsuite/smoke-test/src/rest_api.rs @@ -1,7 +1,9 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 +use aptos_cached_packages::aptos_stdlib; use aptos_crypto::ed25519::Ed25519Signature; +use aptos_forge::Swarm; use aptos_gas::{AptosGasParameters, FromOnChainGasSchedule}; use aptos_rest_client::aptos_api_types::{MoveModuleId, TransactionData}; use aptos_sdk::move_types::language_storage::StructTag; @@ -10,8 +12,6 @@ use aptos_types::account_config::{AccountResource, CORE_CODE_ADDRESS}; use aptos_types::on_chain_config::GasScheduleV2; use aptos_types::transaction::authenticator::AuthenticationKey; use aptos_types::transaction::{SignedTransaction, Transaction}; -use cached_packages::aptos_stdlib; -use forge::Swarm; use std::convert::TryFrom; use std::str::FromStr; diff --git a/testsuite/smoke-test/src/rosetta.rs b/testsuite/smoke-test/src/rosetta.rs index 09ef4ab4a46cd..03f73eef15da9 100644 --- a/testsuite/smoke-test/src/rosetta.rs +++ b/testsuite/smoke-test/src/rosetta.rs @@ -6,10 +6,12 @@ use anyhow::anyhow; use aptos::common::types::GasOptions; use aptos::test::INVALID_ACCOUNT; use aptos::{account::create::DEFAULT_FUNDED_COINS, test::CliTestFramework}; +use aptos_cached_packages::aptos_stdlib; use aptos_config::config::PersistableConfig; use aptos_config::{config::ApiConfig, utils::get_available_port}; use aptos_crypto::ed25519::{Ed25519PrivateKey, Ed25519Signature}; use aptos_crypto::{HashValue, PrivateKey}; +use aptos_forge::{AptosPublicInfo, LocalSwarm, Node, NodeExt, Swarm}; use aptos_gas::{AptosGasParameters, FromOnChainGasSchedule}; use aptos_rest_client::aptos_api_types::{TransactionOnChainData, UserTransaction}; use aptos_rest_client::{Response, Transaction}; @@ -33,8 +35,6 @@ use aptos_types::account_config::CORE_CODE_ADDRESS; use aptos_types::on_chain_config::GasScheduleV2; use aptos_types::transaction::SignedTransaction; use aptos_types::{account_address::AccountAddress, chain_id::ChainId}; -use cached_packages::aptos_stdlib; -use forge::{AptosPublicInfo, LocalSwarm, Node, NodeExt, Swarm}; use std::collections::{BTreeMap, HashSet}; use std::convert::TryFrom; use std::str::FromStr; diff --git a/testsuite/smoke-test/src/smoke_test_environment.rs b/testsuite/smoke-test/src/smoke_test_environment.rs index 800fef57888b8..d68cd7fff6ccc 100644 --- a/testsuite/smoke-test/src/smoke_test_environment.rs +++ b/testsuite/smoke-test/src/smoke_test_environment.rs @@ -6,13 +6,13 @@ use aptos_config::config::NodeConfig; use aptos_config::{keys::ConfigKey, utils::get_available_port}; use aptos_crypto::ed25519::Ed25519PrivateKey; use aptos_faucet::FaucetArgs; +use aptos_forge::{ActiveNodesGuard, Node}; +use aptos_forge::{Factory, LocalFactory, LocalSwarm}; +use aptos_framework::ReleaseBundle; use aptos_genesis::builder::{InitConfigFn, InitGenesisConfigFn}; use aptos_infallible::Mutex; use aptos_logger::prelude::*; use aptos_types::{account_config::aptos_test_root_address, chain_id::ChainId}; -use forge::{ActiveNodesGuard, Node}; -use forge::{Factory, LocalFactory, LocalSwarm}; -use framework::ReleaseBundle; use once_cell::sync::Lazy; use rand::rngs::OsRng; use std::{num::NonZeroUsize, path::PathBuf, sync::Arc}; @@ -49,12 +49,12 @@ impl SwarmBuilder { } pub fn with_aptos(mut self) -> Self { - self.genesis_framework = Some(cached_packages::head_release_bundle().clone()); + self.genesis_framework = Some(aptos_cached_packages::head_release_bundle().clone()); self } pub fn with_aptos_testnet(mut self) -> Self { - self.genesis_framework = Some(framework::testnet_release_bundle().clone()); + self.genesis_framework = Some(aptos_framework::testnet_release_bundle().clone()); self } diff --git a/testsuite/smoke-test/src/state_sync.rs b/testsuite/smoke-test/src/state_sync.rs index 1b6d2bf033b6b..ced8db8ca449e 100644 --- a/testsuite/smoke-test/src/state_sync.rs +++ b/testsuite/smoke-test/src/state_sync.rs @@ -6,10 +6,10 @@ use crate::{ test_utils::{create_and_fund_account, transfer_and_reconfig, transfer_coins}, }; use aptos_config::config::{BootstrappingMode, ContinuousSyncingMode, NodeConfig}; +use aptos_forge::{LocalSwarm, Node, NodeExt, Swarm, SwarmExt}; use aptos_rest_client::Client as RestClient; use aptos_sdk::types::LocalAccount; use aptos_types::{account_address::AccountAddress, PeerId}; -use forge::{LocalSwarm, Node, NodeExt, Swarm, SwarmExt}; use std::{ sync::Arc, time::{Duration, Instant}, diff --git a/testsuite/smoke-test/src/storage.rs b/testsuite/smoke-test/src/storage.rs index 58697f995e756..e052e538d3868 100644 --- a/testsuite/smoke-test/src/storage.rs +++ b/testsuite/smoke-test/src/storage.rs @@ -12,10 +12,10 @@ use crate::{ }; use anyhow::{bail, Result}; use aptos_backup_cli::metadata::view::BackupStorageState; +use aptos_forge::{reconfig, NodeExt, Swarm, SwarmExt}; use aptos_logger::info; use aptos_temppath::TempPath; use aptos_types::{transaction::Version, waypoint::Waypoint}; -use forge::{reconfig, NodeExt, Swarm, SwarmExt}; use std::{ fs, path::Path, diff --git a/testsuite/smoke-test/src/test_smoke_tests.rs b/testsuite/smoke-test/src/test_smoke_tests.rs index 74b51260e033c..dabe664bac7f4 100644 --- a/testsuite/smoke-test/src/test_smoke_tests.rs +++ b/testsuite/smoke-test/src/test_smoke_tests.rs @@ -3,7 +3,7 @@ use crate::smoke_test_environment::SwarmBuilder; use aptos_config::config::NodeConfig; -use forge::{NodeExt, Swarm}; +use aptos_forge::{NodeExt, Swarm}; use std::sync::Arc; use std::time::{Duration, Instant}; diff --git a/testsuite/smoke-test/src/test_utils.rs b/testsuite/smoke-test/src/test_utils.rs index c1d7c2a8019de..7b6422c4d6514 100644 --- a/testsuite/smoke-test/src/test_utils.rs +++ b/testsuite/smoke-test/src/test_utils.rs @@ -1,13 +1,13 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 +use aptos_cached_packages::aptos_stdlib; +use aptos_forge::{reconfig, LocalSwarm, NodeExt, Swarm}; use aptos_rest_client::Client as RestClient; use aptos_sdk::{ transaction_builder::TransactionFactory, types::{transaction::SignedTransaction, LocalAccount}, }; -use cached_packages::aptos_stdlib; -use forge::{reconfig, LocalSwarm, NodeExt, Swarm}; use rand::random; pub async fn create_and_fund_account(swarm: &'_ mut dyn Swarm, amount: u64) -> LocalAccount { diff --git a/testsuite/smoke-test/src/transaction.rs b/testsuite/smoke-test/src/transaction.rs index 356a0471d7aa3..36d38d795fd36 100644 --- a/testsuite/smoke-test/src/transaction.rs +++ b/testsuite/smoke-test/src/transaction.rs @@ -1,6 +1,8 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 +use aptos_cached_packages::aptos_stdlib; +use aptos_forge::Swarm; use aptos_keygen::KeyGen; use aptos_rest_client::{ aptos_api_types::{EntryFunctionPayload, TransactionPayload}, @@ -10,8 +12,6 @@ use aptos_sdk::{ crypto::{PrivateKey, SigningKey}, types::transaction::{authenticator::AuthenticationKey, SignedTransaction}, }; -use cached_packages::aptos_stdlib; -use forge::Swarm; use crate::smoke_test_environment::new_local_swarm_with_aptos; diff --git a/testsuite/smoke-test/src/txn_broadcast.rs b/testsuite/smoke-test/src/txn_broadcast.rs index 911633b7e49ae..8f69617d94117 100644 --- a/testsuite/smoke-test/src/txn_broadcast.rs +++ b/testsuite/smoke-test/src/txn_broadcast.rs @@ -4,7 +4,7 @@ use crate::smoke_test_environment::SwarmBuilder; use crate::test_utils::{assert_balance, create_and_fund_account, transfer_coins}; use aptos_config::config::NodeConfig; -use forge::{NodeExt, Swarm, SwarmExt}; +use aptos_forge::{NodeExt, Swarm, SwarmExt}; use std::sync::Arc; use std::time::{Duration, Instant}; diff --git a/testsuite/smoke-test/src/txn_emitter.rs b/testsuite/smoke-test/src/txn_emitter.rs index aec3ffb6a4810..4e84691953b64 100644 --- a/testsuite/smoke-test/src/txn_emitter.rs +++ b/testsuite/smoke-test/src/txn_emitter.rs @@ -3,10 +3,10 @@ use crate::smoke_test_environment::new_local_swarm_with_aptos; use anyhow::ensure; -use aptos_sdk::{transaction_builder::TransactionFactory, types::PeerId}; -use forge::{ +use aptos_forge::{ EmitJobMode, EmitJobRequest, NodeExt, Result, Swarm, TransactionType, TxnEmitter, TxnStats, }; +use aptos_sdk::{transaction_builder::TransactionFactory, types::PeerId}; use rand::{rngs::OsRng, SeedableRng}; use std::time::Duration; use tokio::runtime::Builder; diff --git a/testsuite/smoke-test/src/upgrade.rs b/testsuite/smoke-test/src/upgrade.rs index 52a0d741a58ce..5e7f69e18e90a 100644 --- a/testsuite/smoke-test/src/upgrade.rs +++ b/testsuite/smoke-test/src/upgrade.rs @@ -6,13 +6,13 @@ use crate::{ test_utils::check_create_mint_transfer, workspace_builder, workspace_builder::workspace_root, }; use aptos_crypto::ValidCryptoMaterialStringExt; +use aptos_forge::Swarm; use aptos_gas::{AptosGasParameters, GasQuantity, InitialGasSchedule, ToOnChainGasSchedule}; use aptos_release_builder::components::{ feature_flags::{FeatureFlag, Features}, gas::generate_gas_upgrade_proposal, }; use aptos_temppath::TempPath; -use forge::Swarm; use std::fs; use std::process::Command; diff --git a/testsuite/smoke-test/src/workspace_builder.rs b/testsuite/smoke-test/src/workspace_builder.rs index ea18a1ef4e1df..8dedb7be291e2 100644 --- a/testsuite/smoke-test/src/workspace_builder.rs +++ b/testsuite/smoke-test/src/workspace_builder.rs @@ -5,8 +5,8 @@ //! //! This utility is to only be used inside of smoke test. +use aptos_forge::cargo_build_common_args; use aptos_logger::prelude::*; -use forge::cargo_build_common_args; use once_cell::sync::Lazy; use std::{env, path::PathBuf, process::Command}; diff --git a/testsuite/testcases/Cargo.toml b/testsuite/testcases/Cargo.toml index a9f88b0240876..7b16d7c385982 100644 --- a/testsuite/testcases/Cargo.toml +++ b/testsuite/testcases/Cargo.toml @@ -15,6 +15,7 @@ rust-version = { workspace = true } [dependencies] anyhow = { workspace = true } aptos = { workspace = true, features = ["fuzzing"] } +aptos-forge = { workspace = true } aptos-genesis = { workspace = true } aptos-global-constants = { workspace = true } aptos-keygen = { workspace = true } @@ -22,7 +23,6 @@ aptos-logger = { workspace = true } aptos-rest-client = { workspace = true } aptos-sdk = { workspace = true } aptos-types = { workspace = true } -forge = { workspace = true } futures = { workspace = true } hex = { workspace = true } move-examples = { workspace = true } diff --git a/testsuite/testcases/src/compatibility_test.rs b/testsuite/testcases/src/compatibility_test.rs index 3ac575c340c73..cf47fe519464a 100644 --- a/testsuite/testcases/src/compatibility_test.rs +++ b/testsuite/testcases/src/compatibility_test.rs @@ -3,8 +3,8 @@ use crate::{batch_update, generate_traffic}; use anyhow::bail; +use aptos_forge::{NetworkContext, NetworkTest, Result, SwarmExt, Test}; use aptos_logger::info; -use forge::{NetworkContext, NetworkTest, Result, SwarmExt, Test}; use tokio::{runtime::Runtime, time::Duration}; pub struct SimpleValidatorUpgrade; diff --git a/testsuite/testcases/src/consensus_reliability_tests.rs b/testsuite/testcases/src/consensus_reliability_tests.rs index 4329ff0620f0a..6a7a43e9836f4 100644 --- a/testsuite/testcases/src/consensus_reliability_tests.rs +++ b/testsuite/testcases/src/consensus_reliability_tests.rs @@ -3,11 +3,11 @@ use crate::{LoadDestination, NetworkLoadTest}; use anyhow::{anyhow, bail, Context}; -use aptos_logger::{info, warn}; -use forge::test_utils::consensus_utils::{ +use aptos_forge::test_utils::consensus_utils::{ test_consensus_fault_tolerance, FailPointFailureInjection, NodeState, }; -use forge::{NetworkContext, NetworkTest, Result, Swarm, SwarmExt, Test}; +use aptos_forge::{NetworkContext, NetworkTest, Result, Swarm, SwarmExt, Test}; +use aptos_logger::{info, warn}; use rand::Rng; use std::collections::HashSet; use std::time::Duration; diff --git a/testsuite/testcases/src/forge_setup_test.rs b/testsuite/testcases/src/forge_setup_test.rs index 7d0c79293fc9f..c88a01d2fdb5b 100644 --- a/testsuite/testcases/src/forge_setup_test.rs +++ b/testsuite/testcases/src/forge_setup_test.rs @@ -3,8 +3,8 @@ use std::thread; +use aptos_forge::{NetworkContext, NetworkTest, Result, Test}; use aptos_logger::info; -use forge::{NetworkContext, NetworkTest, Result, Test}; use rand::{ rngs::{OsRng, StdRng}, seq::IteratorRandom, diff --git a/testsuite/testcases/src/fullnode_reboot_stress_test.rs b/testsuite/testcases/src/fullnode_reboot_stress_test.rs index d629378da8ce9..328a874868129 100644 --- a/testsuite/testcases/src/fullnode_reboot_stress_test.rs +++ b/testsuite/testcases/src/fullnode_reboot_stress_test.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::{LoadDestination, NetworkLoadTest}; -use forge::{NetworkContext, NetworkTest, Result, Swarm, Test}; +use aptos_forge::{NetworkContext, NetworkTest, Result, Swarm, Test}; use rand::seq::SliceRandom; use rand::thread_rng; use std::time::Duration; diff --git a/testsuite/testcases/src/lib.rs b/testsuite/testcases/src/lib.rs index 3b8b6dccec3af..925bdfa09746f 100644 --- a/testsuite/testcases/src/lib.rs +++ b/testsuite/testcases/src/lib.rs @@ -21,12 +21,12 @@ pub mod validator_join_leave_test; pub mod validator_reboot_stress_test; use anyhow::{anyhow, Context}; -use aptos_logger::info; -use aptos_sdk::{transaction_builder::TransactionFactory, types::PeerId}; -use forge::{ +use aptos_forge::{ EmitJobRequest, NetworkContext, NetworkTest, NodeExt, Result, Swarm, SwarmExt, Test, TxnEmitter, TxnStats, Version, }; +use aptos_logger::info; +use aptos_sdk::{transaction_builder::TransactionFactory, types::PeerId}; use futures::future::join_all; use rand::{rngs::StdRng, SeedableRng}; use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH}; diff --git a/testsuite/testcases/src/load_vs_perf_benchmark.rs b/testsuite/testcases/src/load_vs_perf_benchmark.rs index 5cf2b85dd7d13..4fcefe3fde38b 100644 --- a/testsuite/testcases/src/load_vs_perf_benchmark.rs +++ b/testsuite/testcases/src/load_vs_perf_benchmark.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use crate::NetworkLoadTest; +use aptos_forge::{EmitJobMode, NetworkContext, NetworkTest, Result, Test, TxnStats}; use aptos_logger::info; -use forge::{EmitJobMode, NetworkContext, NetworkTest, Result, Test, TxnStats}; use rand::SeedableRng; use std::time::Duration; use tokio::runtime::Runtime; diff --git a/testsuite/testcases/src/network_bandwidth_test.rs b/testsuite/testcases/src/network_bandwidth_test.rs index 06814a5d63218..7d3298190e816 100644 --- a/testsuite/testcases/src/network_bandwidth_test.rs +++ b/testsuite/testcases/src/network_bandwidth_test.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::{LoadDestination, NetworkLoadTest}; -use forge::{NetworkContext, NetworkTest, Swarm, SwarmChaos, SwarmNetworkBandwidth, Test}; +use aptos_forge::{NetworkContext, NetworkTest, Swarm, SwarmChaos, SwarmNetworkBandwidth, Test}; pub struct NetworkBandwidthTest; diff --git a/testsuite/testcases/src/network_loss_test.rs b/testsuite/testcases/src/network_loss_test.rs index 3d94de2845a6b..43b9c535c9991 100644 --- a/testsuite/testcases/src/network_loss_test.rs +++ b/testsuite/testcases/src/network_loss_test.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::{LoadDestination, NetworkLoadTest}; -use forge::{NetworkContext, NetworkTest, Swarm, SwarmChaos, SwarmNetworkLoss, Test}; +use aptos_forge::{NetworkContext, NetworkTest, Swarm, SwarmChaos, SwarmNetworkLoss, Test}; pub struct NetworkLossTest; diff --git a/testsuite/testcases/src/network_partition_test.rs b/testsuite/testcases/src/network_partition_test.rs index 2a013b5ce1a3d..5d7f2382622c3 100644 --- a/testsuite/testcases/src/network_partition_test.rs +++ b/testsuite/testcases/src/network_partition_test.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::{LoadDestination, NetworkLoadTest}; -use forge::{NetworkContext, NetworkTest, Swarm, SwarmChaos, SwarmNetworkPartition, Test}; +use aptos_forge::{NetworkContext, NetworkTest, Swarm, SwarmChaos, SwarmNetworkPartition, Test}; pub struct NetworkPartitionTest; diff --git a/testsuite/testcases/src/partial_nodes_down_test.rs b/testsuite/testcases/src/partial_nodes_down_test.rs index d743d42989e77..0d1dd0bd39b0c 100644 --- a/testsuite/testcases/src/partial_nodes_down_test.rs +++ b/testsuite/testcases/src/partial_nodes_down_test.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::generate_traffic; -use forge::{NetworkContext, NetworkTest, Result, Test}; +use aptos_forge::{NetworkContext, NetworkTest, Result, Test}; use std::thread; use tokio::{runtime::Runtime, time::Duration}; diff --git a/testsuite/testcases/src/performance_test.rs b/testsuite/testcases/src/performance_test.rs index f690ab061a2ae..c0d6e9914c83f 100644 --- a/testsuite/testcases/src/performance_test.rs +++ b/testsuite/testcases/src/performance_test.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::NetworkLoadTest; -use forge::{NetworkContext, NetworkTest, Result, Test}; +use aptos_forge::{NetworkContext, NetworkTest, Result, Test}; pub struct PerformanceBenchmark; diff --git a/testsuite/testcases/src/performance_with_fullnode_test.rs b/testsuite/testcases/src/performance_with_fullnode_test.rs index 785dddd6cba87..d329bcabe71e9 100644 --- a/testsuite/testcases/src/performance_with_fullnode_test.rs +++ b/testsuite/testcases/src/performance_with_fullnode_test.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::{LoadDestination, NetworkLoadTest}; -use forge::{NetworkContext, NetworkTest, Result, Test}; +use aptos_forge::{NetworkContext, NetworkTest, Result, Test}; pub struct PerformanceBenchmarkWithFN; diff --git a/testsuite/testcases/src/reconfiguration_test.rs b/testsuite/testcases/src/reconfiguration_test.rs index 123b2e11dc380..43e4faf2a1eff 100644 --- a/testsuite/testcases/src/reconfiguration_test.rs +++ b/testsuite/testcases/src/reconfiguration_test.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use anyhow::anyhow; -use forge::{NetworkContext, NetworkTest, Result, Test}; +use aptos_forge::{NetworkContext, NetworkTest, Result, Test}; pub struct ReconfigurationTest; diff --git a/testsuite/testcases/src/state_sync_performance.rs b/testsuite/testcases/src/state_sync_performance.rs index 9a69291a28542..ecb7d0d15d446 100644 --- a/testsuite/testcases/src/state_sync_performance.rs +++ b/testsuite/testcases/src/state_sync_performance.rs @@ -3,12 +3,12 @@ use crate::generate_traffic; use anyhow::bail; -use aptos_logger::info; -use aptos_sdk::move_types::account_address::AccountAddress; -use forge::{ +use aptos_forge::{ get_highest_synced_epoch, get_highest_synced_version, NetworkContext, NetworkTest, Result, SwarmExt, Test, }; +use aptos_logger::info; +use aptos_sdk::move_types::account_address::AccountAddress; use std::time::Instant; use tokio::{runtime::Runtime, time::Duration}; diff --git a/testsuite/testcases/src/three_region_simulation_test.rs b/testsuite/testcases/src/three_region_simulation_test.rs index 89709df6a1c87..4772219fdb535 100644 --- a/testsuite/testcases/src/three_region_simulation_test.rs +++ b/testsuite/testcases/src/three_region_simulation_test.rs @@ -2,11 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 use crate::{LoadDestination, NetworkLoadTest}; -use aptos_logger::info; -use forge::{ +use aptos_forge::{ GroupNetworkDelay, NetworkContext, NetworkTest, Swarm, SwarmChaos, SwarmExt, SwarmNetworkBandwidth, SwarmNetworkDelay, Test, }; +use aptos_logger::info; use rand::Rng; use tokio::runtime::Runtime; diff --git a/testsuite/testcases/src/twin_validator_test.rs b/testsuite/testcases/src/twin_validator_test.rs index 9495c7775b6b6..cf22fc3942c1a 100644 --- a/testsuite/testcases/src/twin_validator_test.rs +++ b/testsuite/testcases/src/twin_validator_test.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use crate::{LoadDestination, NetworkLoadTest}; +use aptos_forge::{NetworkContext, NetworkTest, NodeExt, Test}; use aptos_sdk::move_types::account_address::AccountAddress; -use forge::{NetworkContext, NetworkTest, NodeExt, Test}; use std::time::{Duration, Instant}; use tokio::runtime::Runtime; diff --git a/testsuite/testcases/src/two_traffics_test.rs b/testsuite/testcases/src/two_traffics_test.rs index 08eb5cc618f2b..0a64900baeb72 100644 --- a/testsuite/testcases/src/two_traffics_test.rs +++ b/testsuite/testcases/src/two_traffics_test.rs @@ -7,11 +7,11 @@ use crate::{ create_emitter_and_request, traffic_emitter_runtime, LoadDestination, NetworkLoadTest, }; use anyhow::bail; -use aptos_logger::info; -use forge::{ +use aptos_forge::{ success_criteria::{LatencyType, SuccessCriteriaChecker}, EmitJobMode, EmitJobRequest, NetworkContext, NetworkTest, Result, Swarm, Test, }; +use aptos_logger::info; use rand::{rngs::OsRng, Rng, SeedableRng}; pub struct TwoTrafficsTest { diff --git a/testsuite/testcases/src/validator_join_leave_test.rs b/testsuite/testcases/src/validator_join_leave_test.rs index 6ebac27b329b2..c037530158220 100644 --- a/testsuite/testcases/src/validator_join_leave_test.rs +++ b/testsuite/testcases/src/validator_join_leave_test.rs @@ -3,12 +3,12 @@ use crate::{LoadDestination, NetworkLoadTest}; use aptos::account::create::DEFAULT_FUNDED_COINS; +use aptos_forge::{ + reconfig, NetworkContext, NetworkTest, NodeExt, Result, Swarm, SwarmExt, Test, FORGE_KEY_SEED, +}; use aptos_logger::info; use aptos_sdk::crypto::ed25519::Ed25519PrivateKey; use aptos_sdk::crypto::PrivateKey; -use forge::{ - reconfig, NetworkContext, NetworkTest, NodeExt, Result, Swarm, SwarmExt, Test, FORGE_KEY_SEED, -}; use aptos_keygen::KeyGen; diff --git a/testsuite/testcases/src/validator_reboot_stress_test.rs b/testsuite/testcases/src/validator_reboot_stress_test.rs index 52915d57d6012..54a9ee0cd9ebd 100644 --- a/testsuite/testcases/src/validator_reboot_stress_test.rs +++ b/testsuite/testcases/src/validator_reboot_stress_test.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::{LoadDestination, NetworkLoadTest}; -use forge::{NetworkContext, NetworkTest, Result, Swarm, Test}; +use aptos_forge::{NetworkContext, NetworkTest, Result, Swarm, Test}; use rand::seq::SliceRandom; use rand::thread_rng; use std::time::Duration; diff --git a/testsuite/testcases/tests/forge-local-compatibility.rs b/testsuite/testcases/tests/forge-local-compatibility.rs index ef28052a07239..1484740b3940c 100644 --- a/testsuite/testcases/tests/forge-local-compatibility.rs +++ b/testsuite/testcases/tests/forge-local-compatibility.rs @@ -1,7 +1,7 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 -use forge::{forge_main, ForgeConfig, InitialVersion, LocalFactory, Options, Result}; +use aptos_forge::{forge_main, ForgeConfig, InitialVersion, LocalFactory, Options, Result}; use std::num::NonZeroUsize; use testcases::compatibility_test::SimpleValidatorUpgrade; diff --git a/testsuite/testcases/tests/forge-local-performance.rs b/testsuite/testcases/tests/forge-local-performance.rs index 77dc5503e61c8..a2ed4b19a6d3b 100644 --- a/testsuite/testcases/tests/forge-local-performance.rs +++ b/testsuite/testcases/tests/forge-local-performance.rs @@ -1,7 +1,7 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 -use forge::{ +use aptos_forge::{ forge_main, success_criteria::{StateProgressThreshold, SuccessCriteria}, EmitJobMode, EmitJobRequest, ForgeConfig, InitialVersion, LocalFactory, Options, Result, diff --git a/vm-validator/Cargo.toml b/vm-validator/Cargo.toml index 75b61cb46e12d..65ffd1dcf6b3e 100644 --- a/vm-validator/Cargo.toml +++ b/vm-validator/Cargo.toml @@ -23,14 +23,14 @@ scratchpad = { workspace = true } storage-interface = { workspace = true } [dev-dependencies] +aptos-cached-packages = { workspace = true } aptos-crypto = { 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 } aptosdb = { workspace = true } -cached-packages = { workspace = true } -executor-test-helpers = { workspace = true } move-core-types = { workspace = true } rand = { workspace = true } vm-genesis = { workspace = true } diff --git a/vm-validator/src/unit_tests/vm_validator_test.rs b/vm-validator/src/unit_tests/vm_validator_test.rs index 9a1b05a7e950d..3e115563a63d7 100644 --- a/vm-validator/src/unit_tests/vm_validator_test.rs +++ b/vm-validator/src/unit_tests/vm_validator_test.rs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 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_gas::{InitialGasSchedule, TransactionGasParameters}; use aptos_types::{ @@ -13,7 +14,6 @@ use aptos_types::{ }; use aptos_vm::AptosVM; use aptosdb::AptosDB; -use cached_packages::aptos_stdlib; use move_core_types::account_address::AccountAddress; use rand::SeedableRng; use storage_interface::state_view::LatestDbStateCheckpointView; @@ -31,7 +31,7 @@ impl TestValidator { let _db_path = aptos_temppath::TempPath::new(); _db_path.create_as_dir().unwrap(); let (db, db_rw) = DbReaderWriter::wrap(AptosDB::new_for_test(_db_path.path())); - executor_test_helpers::bootstrap_genesis::( + aptos_executor_test_helpers::bootstrap_genesis::( &db_rw, &vm_genesis::test_genesis_transaction(), )