diff --git a/Cargo.lock b/Cargo.lock index c03d327359b..9b5a088b1c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12882,7 +12882,6 @@ dependencies = [ "ic-test-utilities-logger", "ic-test-utilities-metrics", "ic-test-utilities-state", - "ic-test-utilities-time", "ic-test-utilities-tmpdir", "ic-test-utilities-types", "ic-types", diff --git a/rs/state_manager/BUILD.bazel b/rs/state_manager/BUILD.bazel index 1296768a14b..823833df57d 100644 --- a/rs/state_manager/BUILD.bazel +++ b/rs/state_manager/BUILD.bazel @@ -3,16 +3,92 @@ load("//bazel:defs.bzl", "rust_bench", "rust_ic_test") package(default_visibility = ["//visibility:public"]) +DEPENDENCIES = [ + # Keep sorted. + "//rs/canonical_state", + "//rs/canonical_state/tree_hash", + "//rs/config", + "//rs/crypto/sha2", + "//rs/crypto/tree_hash", + "//rs/interfaces", + "//rs/interfaces/certified_stream_store", + "//rs/interfaces/state_manager", + "//rs/monitoring/logger", + "//rs/monitoring/metrics", + "//rs/protobuf", + "//rs/registry/routing_table", + "//rs/registry/subnet_type", + "//rs/replicated_state", + "//rs/state_layout", + "//rs/sys", + "//rs/tree_deserializer", + "//rs/types/base_types", + "//rs/types/types", + "//rs/utils", + "//rs/utils/thread", + "//rs/utils/validate_eq", + "@crate_index//:bit-vec", + "@crate_index//:crossbeam-channel", + "@crate_index//:hex", + "@crate_index//:nix", + "@crate_index//:parking_lot", + "@crate_index//:prometheus", + "@crate_index//:prost", + "@crate_index//:rand", + "@crate_index//:rand_chacha", + "@crate_index//:scoped_threadpool", + "@crate_index//:serde", + "@crate_index//:serde_bytes", + "@crate_index//:slog", + "@crate_index//:tempfile", + "@crate_index//:uuid", +] + MACRO_DEPENDENCIES = [ # Keep sorted. "@crate_index//:strum_macros", ] +DEV_DEPENDENCIES = [ + # Keep sorted. + "//packages/ic-error-types", + "//rs/test_utilities/consensus", + "//rs/test_utilities/logger", + "//rs/test_utilities/state", + "//rs/test_utilities/tmpdir", + "//rs/test_utilities/types", + "//rs/types/management_canister_types", + "//rs/types/wasm_types", + "@crate_index//:assert_matches", + "@crate_index//:maplit", + "@crate_index//:proptest", + "@crate_index//:strum", +] + MACRO_DEV_DEPENDENCIES = [ # Keep sorted. "@crate_index//:test-strategy", ] +BIN_DEPENDENCIES = [ + # Keep sorted. + "//packages/ic-error-types", + "//rs/canonical_state", + "//rs/canonical_state/certification_version", + "//rs/canonical_state/tree_hash", + "//rs/canonical_state/tree_hash/test_utils", + "//rs/criterion_time", + "//rs/crypto/tree_hash", + "//rs/registry/subnet_type", + "//rs/replicated_state", + "//rs/test_utilities/state", + "//rs/test_utilities/types", + "//rs/types/base_types", + "//rs/types/types", + "@crate_index//:criterion", + "@crate_index//:maplit", +] + rust_library( name = "state_manager", srcs = glob(["src/**"]), @@ -23,146 +99,37 @@ rust_library( crate_name = "ic_state_manager", proc_macro_deps = MACRO_DEPENDENCIES, version = "0.9.0", - deps = [ - # Keep sorted. - "//packages/ic-error-types", - "//rs/canonical_state", - "//rs/canonical_state/tree_hash", - "//rs/config", - "//rs/crypto/sha2", - "//rs/crypto/tree_hash", - "//rs/interfaces", - "//rs/interfaces/certified_stream_store", - "//rs/interfaces/state_manager", - "//rs/monitoring/logger", - "//rs/monitoring/metrics", - "//rs/protobuf", - "//rs/registry/routing_table", - "//rs/registry/subnet_type", - "//rs/replicated_state", - "//rs/state_layout", - "//rs/sys", - "//rs/tree_deserializer", - "//rs/types/base_types", - "//rs/types/types", - "//rs/utils", - "//rs/utils/thread", - "//rs/utils/validate_eq", - "@crate_index//:bit-vec", - "@crate_index//:crossbeam-channel", - "@crate_index//:hex", - "@crate_index//:nix", - "@crate_index//:parking_lot", - "@crate_index//:prometheus", - "@crate_index//:prost", - "@crate_index//:rand", - "@crate_index//:rand_chacha", - "@crate_index//:scoped_threadpool", - "@crate_index//:serde", - "@crate_index//:serde_bytes", - "@crate_index//:slog", - "@crate_index//:strum", - "@crate_index//:tempfile", - "@crate_index//:uuid", - ], + deps = DEPENDENCIES, ) rust_test( - name = "state_manager_lib_tests", + name = "state_manager_test", timeout = "long", crate = ":state_manager", proc_macro_deps = MACRO_DEV_DEPENDENCIES, - deps = [ - # Keep sorted. - "//packages/ic-error-types", - "//rs/registry/routing_table", - "//rs/registry/subnet_features", - "//rs/registry/subnet_type", - "//rs/test_utilities/consensus", - "//rs/test_utilities/logger", - "//rs/test_utilities/state", - "//rs/test_utilities/time", - "//rs/test_utilities/tmpdir", - "//rs/test_utilities/types", - "//rs/types/management_canister_types", - "//rs/types/wasm_types", - "@crate_index//:assert_matches", - "@crate_index//:maplit", - "@crate_index//:proptest", - "@crate_index//:strum", - "@crate_index//:tempfile", - ], + deps = DEV_DEPENDENCIES, ) rust_ic_test( - name = "state_manager_integration_test", + name = "state_manager_integration", timeout = "long", srcs = [ "tests/common/mod.rs", "tests/state_manager.rs", ], crate_root = "tests/state_manager.rs", - proc_macro_deps = MACRO_DEV_DEPENDENCIES, - deps = [ + proc_macro_deps = MACRO_DEPENDENCIES + MACRO_DEV_DEPENDENCIES, + deps = [":state_manager"] + DEPENDENCIES + DEV_DEPENDENCIES + [ # Keep sorted. - ":state_manager", - "//rs/canonical_state/certification_version", - "//rs/config", - "//rs/crypto/tree_hash", - "//rs/interfaces", - "//rs/interfaces/certified_stream_store", - "//rs/interfaces/state_manager", - "//rs/monitoring/logger", - "//rs/monitoring/metrics", "//rs/registry/subnet_features", - "//rs/registry/subnet_type", - "//rs/replicated_state", - "//rs/state_layout", "//rs/state_machine_tests", - "//rs/sys", - "//rs/test_utilities/consensus", "//rs/test_utilities/io", - "//rs/test_utilities/logger", "//rs/test_utilities/metrics", - "//rs/test_utilities/state", - "//rs/test_utilities/time", - "//rs/test_utilities/tmpdir", - "//rs/test_utilities/types", - "//rs/types/base_types", - "//rs/types/management_canister_types", - "//rs/types/types", - "//rs/types/wasm_types", - "@crate_index//:assert_matches", - "@crate_index//:crossbeam-channel", - "@crate_index//:maplit", - "@crate_index//:nix", - "@crate_index//:proptest", - "@crate_index//:scoped_threadpool", - "@crate_index//:tempfile", ], ) rust_bench( name = "traversal_bench", srcs = ["benches/bench_traversal.rs"], - deps = [ - # Keep sorted. - ":state_manager", - "//packages/ic-error-types", - "//rs/canonical_state", - "//rs/canonical_state/certification_version", - "//rs/canonical_state/tree_hash", - "//rs/canonical_state/tree_hash/test_utils", - "//rs/criterion_time", - "//rs/crypto/tree_hash", - "//rs/registry/subnet_type", - "//rs/replicated_state", - "//rs/test_utilities/state", - "//rs/test_utilities/time", - "//rs/test_utilities/types", - "//rs/types/base_types", - "//rs/types/types", - "@crate_index//:criterion", - "@crate_index//:maplit", - ], + deps = [":state_manager"] + BIN_DEPENDENCIES, ) diff --git a/rs/state_manager/Cargo.toml b/rs/state_manager/Cargo.toml index bddd768f025..127d22fa3f6 100644 --- a/rs/state_manager/Cargo.toml +++ b/rs/state_manager/Cargo.toml @@ -16,7 +16,6 @@ ic-canonical-state-tree-hash = { path = "../canonical_state/tree_hash" } ic-config = { path = "../config" } ic-crypto-sha2 = { path = "../crypto/sha2" } ic-crypto-tree-hash = { path = "../crypto/tree_hash" } -ic-error-types = { path = "../../packages/ic-error-types" } ic-interfaces = { path = "../interfaces" } ic-interfaces-certified-stream-store = { path = "../interfaces/certified_stream_store" } ic-interfaces-state-manager = { path = "../interfaces/state_manager" } @@ -59,17 +58,14 @@ ic-canonical-state-tree-hash-test-utils = { path = "../canonical_state/tree_hash ic-certification-version = { path = "../canonical_state/certification_version" } ic-error-types = { path = "../../packages/ic-error-types" } ic-management-canister-types-private = { path = "../types/management_canister_types" } -ic-registry-routing-table = { path = "../registry/routing_table" } ic-registry-subnet-features = { path = "../registry/subnet_features" } ic-registry-subnet-type = { path = "../registry/subnet_type" } ic-state-machine-tests = { path = "../state_machine_tests" } -ic-sys = { path = "../sys" } ic-test-utilities-consensus = { path = "../test_utilities/consensus" } ic-test-utilities-io = { path = "../test_utilities/io" } ic-test-utilities-logger = { path = "../test_utilities/logger" } ic-test-utilities-metrics = { path = "../test_utilities/metrics" } ic-test-utilities-state = { path = "../test_utilities/state" } -ic-test-utilities-time = { path = "../test_utilities/time" } ic-test-utilities-tmpdir = { path = "../test_utilities/tmpdir" } ic-test-utilities-types = { path = "../test_utilities/types" } ic-wasm-types = { path = "../types/wasm_types" }