Skip to content

chore: simplify dependency graph - #11669

Merged
basvandijk merged 9 commits into
masterfrom
nm-dependency-cleanup
Sep 30, 2026
Merged

basvandijk merged 9 commits into
masterfrom
nm-dependency-cleanup

Conversation

@nmattia

@nmattia nmattia commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

This removes a lot of small dependencies that are better inlined. By inlining we remove a lot of transitive dependencies. This speeds up the build and avoids a whole class of suply-chain attacks.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The workspace-wide dependency and behavior migrations span many critical components and require comprehensive Cargo and Bazel validation before approval.

Review effort: Balanced
Findings: None

What changed in this PR

This PR reduces Rust and Bazel dependency graph complexity by removing unused dependencies and replacing several small crates with standard-library or existing workspace functionality.

Changes:

  • Removes unused Cargo and Bazel dependencies across many crates.
  • Replaces helper crates with OnceLock, LazyLock, available_parallelism, flate2, tracing, and local implementations.
  • Consolidates Bitcoin dependencies and removes the obsolete PCRE2 patch.
File Description
rs/​utils/​Cargo.toml Removes unused test dependencies.
rs/​utils/​BUILD.bazel Mirrors utility dependency cleanup.
rs/​types/​types/​src/​replica_version.rs Replaces OnceCell with OnceLock.
rs/​types/​types/​Cargo.toml Removes once_cell.
rs/​types/​types/​BUILD.bazel Mirrors once_cell removal.
rs/​types/​base_types/​Cargo.toml Removes unused dependencies.
rs/​types/​base_types/​BUILD.bazel Mirrors base-types cleanup.
rs/​tests/​testnets/​mainnet_nns/​src/​proposals.rs Replaces OnceCell with OnceLock.
rs/​tests/​testnets/​mainnet_nns/​Cargo.toml Removes once_cell.
rs/​tests/​testnets/​mainnet_nns/​BUILD.bazel Mirrors once_cell removal.
rs/​tests/​nns/​sns/​lib/​Cargo.toml Removes unused canister client dependency.
rs/​tests/​nns/​sns/​lib/​BUILD.bazel Mirrors SNS test-library cleanup.
rs/​tests/​nns/​sns/​Cargo.toml Removes unused decimal dependency.
rs/​tests/​nns/​nns_dapp/​Cargo.toml Removes unused ledger dependency.
rs/​tests/​nns/​nns_dapp/​BUILD.bazel Mirrors ledger dependency removal.
rs/​tests/​nns/​nns_dapp_test.rs Migrates gzip decoding to flate2.
rs/​tests/​nns/​cycles_minting/​Cargo.toml Removes unused test dependencies.
rs/​tests/​nns/​cycles_minting/​BUILD.bazel Mirrors cycles-minting cleanup.
rs/​tests/​nns/​Cargo.toml Consolidates gzip and removes unused dependencies.
rs/​tests/​nns/​BUILD.bazel Mirrors NNS test dependency changes.
rs/​tests/​financial_integrations/​rosetta/​rosetta_neuron_follow_test.rs Uses standard JSON equality.
rs/​tests/​financial_integrations/​rosetta/​Cargo.toml Removes assert-json-diff.
rs/​tests/​financial_integrations/​rosetta/​BUILD.bazel Mirrors assertion dependency removal.
rs/​tests/​financial_integrations/​BUILD.bazel Removes unused proc-macro dependency.
rs/​tests/​driver/​src/​util.rs Uses shared parallelism helper.
rs/​tests/​driver/​src/​driver/​group.rs Replaces num_cpus with std API.
rs/​tests/​driver/​Cargo.toml Removes unused driver dependencies.
rs/​tests/​driver/​BUILD.bazel Mirrors driver dependency cleanup.
rs/​sys/​Cargo.toml Removes cvt.
rs/​sys/​BUILD.bazel Mirrors cvt removal.
rs/​state_manager/​Cargo.toml Removes unused dependencies.
rs/​state_manager/​BUILD.bazel Mirrors state-manager cleanup.
rs/​sns/​root/​Cargo.toml Removes unused management types.
rs/​sns/​root/​BUILD.bazel Mirrors SNS root cleanup.
rs/​sns/​init/​Cargo.toml Removes unused helper crates.
rs/​sns/​init/​BUILD.bazel Mirrors SNS init cleanup.
rs/​sns/​cli/​Cargo.toml Removes unused serialization helpers.
rs/​sns/​cli/​BUILD.bazel Mirrors SNS CLI cleanup.
rs/​sns/​audit/​Cargo.toml Removes unused audit dependencies.
rs/​sns/​audit/​BUILD.bazel Mirrors audit cleanup.
rs/​rust_canisters/​xnet_test/​src/​main.rs Replaces PCG with SmallRng.
rs/​rust_canisters/​xnet_test/​Cargo.toml Removes rand_pcg.
rs/​rust_canisters/​xnet_test/​BUILD.bazel Mirrors RNG dependency removal.
rs/​rust_canisters/​tests/​src/​stable.rs Replaces PCG with SmallRng.
rs/​rust_canisters/​tests/​Cargo.toml Removes rand_pcg.
rs/​rust_canisters/​tests/​BUILD.bazel Mirrors RNG cleanup.
rs/​rust_canisters/​memory_test/​src/​main.rs Replaces PCG with SmallRng.
rs/​rust_canisters/​memory_test/​Cargo.toml Removes rand_pcg.
rs/​rust_canisters/​memory_test/​BUILD.bazel Mirrors RNG cleanup.
rs/​rust_canisters/​canister_serve/​Cargo.toml Removes unused queue helpers.
rs/​rust_canisters/​canister_serve/​BUILD.bazel Mirrors canister-serve cleanup.
rs/​rust_canisters/​canister_creator/​BUILD.bazel Removes unused PCG dependency.
rs/​rosetta-api/​icrc1/​Cargo.toml Removes unused runtime and test dependencies.
rs/​rosetta-api/​icp/​tests/​integration_tests/​Cargo.toml Removes redundant ledger dependency.
rs/​rosetta-api/​icp/​tests/​integration_tests/​BUILD.bazel Mirrors ledger cleanup.
rs/​rosetta-api/​icp/​test_utils/​Cargo.toml Removes unused Base64 dependency.
rs/​rosetta-api/​icp/​test_utils/​BUILD.bazel Mirrors Base64 removal.
rs/​rosetta-api/​icp/​Cargo.toml Removes unused test dependencies.
rs/​rosetta-api/​icp/​BUILD.bazel Mirrors Rosetta test cleanup.
rs/​rosetta-api/​common/​rosetta_core/​Cargo.toml Removes unused Tower HTTP dependency.
rs/​rosetta-api/​common/​rosetta_core/​BUILD.bazel Mirrors Tower HTTP removal.
rs/​replicated_state/​src/​page_map/​page_allocator/​mmap.rs Uses ic_sys conversion helpers.
rs/​replicated_state/​Cargo.toml Removes cvt and unused logging dependency.
rs/​replicated_state/​BUILD.bazel Mirrors replicated-state cleanup.
rs/​replica/​setup_ic_network/​Cargo.toml Removes direct slog dependency.
rs/​replica/​setup_ic_network/​BUILD.bazel Mirrors logging cleanup.
rs/​replica/​Cargo.toml Removes unused replica dependencies.
rs/​replica/​BUILD.bazel Mirrors replica dependency cleanup.
rs/​replica/​bin/​replica/​main.rs Uses std parallelism detection.
rs/​p2p/​test_utils/​Cargo.toml Removes direct slog dependency.
rs/​p2p/​test_utils/​BUILD.bazel Mirrors logging cleanup.
rs/​p2p/​state_sync_manager/​Cargo.toml Removes direct slog dependency.
rs/​p2p/​state_sync_manager/​BUILD.bazel Mirrors logging cleanup.
rs/​p2p/​quic_transport/​Cargo.toml Removes direct slog dependency.
rs/​p2p/​quic_transport/​BUILD.bazel Mirrors logging cleanup.
rs/​p2p/​peer_manager/​Cargo.toml Removes unused serialization and logging dependencies.
rs/​p2p/​peer_manager/​BUILD.bazel Mirrors peer-manager cleanup.
rs/​p2p/​consensus_manager/​Cargo.toml Removes direct slog dependency.
rs/​p2p/​consensus_manager/​BUILD.bazel Mirrors logging cleanup.
rs/​p2p/​artifact_manager/​Cargo.toml Removes unused test dependencies.
rs/​p2p/​artifact_manager/​BUILD.bazel Mirrors artifact-manager cleanup.
rs/​p2p/​artifact_downloader/​Cargo.toml Removes unused dependencies.
rs/​p2p/​artifact_downloader/​BUILD.bazel Mirrors downloader cleanup.
rs/​orchestrator/​src/​upgrade.rs Reimplements process re-exec using nix.
rs/​orchestrator/​src/​error.rs Uses io::Error for exec failures.
rs/​orchestrator/​registry_replicator/​Cargo.toml Removes direct slog dependency.
rs/​orchestrator/​registry_replicator/​BUILD.bazel Mirrors logging cleanup.
rs/​orchestrator/​image_upgrader/​Cargo.toml Removes direct slog dependency.
rs/​orchestrator/​image_upgrader/​BUILD.bazel Mirrors logging cleanup.
rs/​orchestrator/​Cargo.toml Removes exec.
rs/​orchestrator/​BUILD.bazel Mirrors exec removal.
rs/​nns/​test_utils/​golden_nns_state/​Cargo.toml Removes unused test dependencies.
rs/​nns/​test_utils/​golden_nns_state/​BUILD.bazel Mirrors golden-state cleanup.
rs/​nns/​handlers/​root/​interface/​Cargo.toml Removes unused management types.
rs/​nns/​handlers/​root/​interface/​BUILD.bazel Mirrors root-interface cleanup.
rs/​nns/​governance/​src/​neuron_store.rs Inlines cloneable trait-object support.
rs/​nns/​governance/​Cargo.toml Removes dyn-clone and unused dependencies.
rs/​nns/​governance/​BUILD.bazel Mirrors dyn-clone removal.
rs/​nns/​cmc/​src/​main.rs Inlines ANSI color formatting.
rs/​nns/​cmc/​Cargo.toml Removes yansi and unused types.
rs/​nns/​cmc/​BUILD.bazel Mirrors CMC dependency cleanup.
rs/​nervous_system/​tools/​sync-with-released-nervous-system-wasms/​Cargo.toml Removes unused tool dependencies.
rs/​nervous_system/​tools/​sync-with-released-nervous-system-wasms/​BUILD.bazel Mirrors tool cleanup.
rs/​nervous_system/​tools/​submit-motion-proposal/​Cargo.toml Removes unused certification dependency.
rs/​nervous_system/​tools/​submit-motion-proposal/​BUILD.bazel Mirrors dependency removal.
rs/​nervous_system/​tools/​signed-canister-reply/​Cargo.toml Removes unused Base64 dependency.
rs/​nervous_system/​tools/​signed-canister-reply/​BUILD.bazel Mirrors Base64 removal.
rs/​nervous_system/​tools/​release-runscript/​Cargo.toml Removes many unused dependencies.
rs/​nervous_system/​tools/​release-runscript/​BUILD.bazel Mirrors release-tool cleanup.
rs/​nervous_system/​tools/​neuron-subaccount/​Cargo.toml Removes unused hex dependency.
rs/​nervous_system/​tools/​neuron-subaccount/​BUILD.bazel Mirrors hex removal.
rs/​nervous_system/​timer_task/​Cargo.toml Removes unused Serde dependency.
rs/​nervous_system/​timer_task/​BUILD.bazel Mirrors Serde removal.
rs/​nervous_system/​temporary/​Cargo.toml Removes unused random test dependency.
rs/​nervous_system/​root/​Cargo.toml Removes unused async-trait dependency.
rs/​nervous_system/​root/​BUILD.bazel Mirrors async-trait removal.
rs/​nervous_system/​rate_limits/​Cargo.toml Removes unused Serde dependency.
rs/​nervous_system/​rate_limits/​BUILD.bazel Mirrors Serde removal.
rs/​nervous_system/​neurons_fund/​nfplot/​Cargo.toml Removes unused Serde dependency.
rs/​nervous_system/​neurons_fund/​nfplot/​BUILD.bazel Mirrors Serde removal.
rs/​nervous_system/​neurons_fund/​Cargo.toml Removes unused test dependencies.
rs/​nervous_system/​neurons_fund/​BUILD.bazel Mirrors test dependency cleanup.
rs/​nervous_system/​common/​test_utils/​src/​wasm_helpers.rs Migrates gzip helpers to flate2.
rs/​nervous_system/​common/​test_utils/​Cargo.toml Replaces libflate with flate2.
rs/​nervous_system/​common/​test_utils/​BUILD.bazel Mirrors gzip dependency migration.
rs/​nervous_system/​common/​test_canister/​Cargo.toml Removes unused test dependencies.
rs/​nervous_system/​common/​src/​serve_logs_tests.rs Uses serde_json instead of JSON5.
rs/​nervous_system/​common/​Cargo.toml Removes unused helper crates.
rs/​nervous_system/​common/​BUILD.bazel Mirrors common-library cleanup.
rs/​nervous_system/​agent/​Cargo.toml Removes unused error-types dependency.
rs/​nervous_system/​agent/​BUILD.bazel Mirrors dependency removal.
rs/​monitoring/​metrics/​Cargo.toml Removes direct test logging dependency.
rs/​monitoring/​metrics/​BUILD.bazel Restricts logger dependency to doc tests.
rs/​monitoring/​metrics_proxy/​src/​server.rs Uses native durations and tracing.
rs/​monitoring/​metrics_proxy/​src/​proxy.rs Removes duration wrapper and uses tracing.
rs/​monitoring/​metrics_proxy/​src/​main.rs Inlines exit codes and tracing setup.
rs/​monitoring/​metrics_proxy/​src/​client.rs Uses native Duration.
rs/​monitoring/​metrics_proxy/​README.md Documents duration syntax.
rs/​monitoring/​metrics_proxy/​Cargo.toml Replaces logging and duration dependencies.
rs/​monitoring/​metrics_proxy/​BUILD.bazel Mirrors metrics-proxy migration.
rs/​monitoring/​logger/​src/​lib.rs Re-exports slog for macros.
rs/​monitoring/​adapter_metrics/​server/​Cargo.toml Removes direct slog dependency.
rs/​monitoring/​adapter_metrics/​server/​BUILD.bazel Mirrors logging cleanup.
rs/​monitoring/​adapter_metrics/​client/​Cargo.toml Removes direct slog dependency.
rs/​monitoring/​adapter_metrics/​client/​BUILD.bazel Mirrors logging cleanup.
rs/​ledger_suite/​test_utils/​state_machine_helpers/​Cargo.toml Removes unused dependencies.
rs/​ledger_suite/​test_utils/​state_machine_helpers/​BUILD.bazel Mirrors helper cleanup.
rs/​ledger_suite/​icrc1/​ledger/​Cargo.toml Removes unused ledger dependencies.
rs/​ledger_suite/​icrc1/​ledger/​BUILD.bazel Mirrors ledger cleanup.
rs/​ledger_suite/​icrc1/​index-ng/​Cargo.toml Removes unused test ledger.
rs/​ledger_suite/​icrc1/​index-ng/​BUILD.bazel Mirrors test-ledger removal.
rs/​ledger_suite/​icrc1/​Cargo.toml Removes unused test dependencies.
rs/​ledger_suite/​icrc1/​BUILD.bazel Mirrors ICRC test cleanup.
rs/​ledger_suite/​icp/​test_utils/​icp_test_ledger/​Cargo.toml Removes unused ledger dependencies.
rs/​ledger_suite/​icp/​test_utils/​icp_test_ledger/​BUILD.bazel Mirrors test-ledger cleanup.
rs/​ledger_suite/​icp/​Cargo.toml Removes unused test dependencies.
rs/​ledger_suite/​icp/​BUILD.bazel Mirrors ICP test cleanup.
rs/​ledger_suite/​icp/​archive/​Cargo.toml Removes unused ledger test utilities.
rs/​ledger_suite/​icp/​archive/​BUILD.bazel Mirrors dependency removal.
rs/​ic_os/​utils/​src/​lib.rs Exposes the local INI module.
rs/​ic_os/​os_tools/​manual_guestos_recovery/​Cargo.toml Removes shell-escape dependency.
rs/​ic_os/​os_tools/​manual_guestos_recovery/​BUILD.bazel Mirrors dependency removal.
rs/​ic_os/​os_tools/​guestos_tool/​Cargo.toml Removes unused Serde dependency.
rs/​ic_os/​os_tools/​guestos_tool/​BUILD.bazel Mirrors Serde removal.
rs/​ic_os/​os_tools/​guest_vm_runner/​src/​main.rs Inlines byte-slice marker search.
rs/​ic_os/​os_tools/​guest_vm_runner/​Cargo.toml Removes helper and test dependencies.
rs/​ic_os/​os_tools/​guest_vm_runner/​BUILD.bazel Mirrors guest-runner cleanup.
rs/​ic_os/​open_rootfs/​Cargo.toml Removes unused verification dependencies.
rs/​ic_os/​open_rootfs/​BUILD.bazel Mirrors open-rootfs cleanup.
rs/​ic_os/​networking/​nss_icos/​Cargo.toml Replaces local-IP helper with nix.
rs/​ic_os/​networking/​nss_icos/​BUILD.bazel Mirrors network dependency replacement.
rs/​ic_os/​guest_upgrade/​tests/​Cargo.toml Removes unused guest-disk dependency.
rs/​ic_os/​guest_upgrade/​tests/​BUILD.bazel Mirrors dependency removal.
rs/​ic_os/​guest_upgrade/​server/​BUILD.bazel Removes unused Tokio stream dependency.
rs/​ic_os/​dev_test_tools/​bare_metal_deployment/​src/​lib.rs Uses repository INI parser.
rs/​ic_os/​dev_test_tools/​bare_metal_deployment/​Cargo.toml Replaces rust-ini with local utilities.
rs/​ic_os/​dev_test_tools/​bare_metal_deployment/​BUILD.bazel Mirrors INI dependency replacement.
rs/​ic_os/​config/​types/​Cargo.toml Removes securefmt.
rs/​ic_os/​config/​types/​BUILD.bazel Removes secure-format proc macro.
rs/​ic_os/​config/​tool/​src/​setupos/​deployment_json.rs Replaces Lazy with LazyLock.
rs/​ic_os/​config/​tool/​src/​setupos/​config_ini.rs Uses repository INI parser.
rs/​ic_os/​config/​tool/​src/​guestos/​network.rs Uses nix::getifaddrs.
rs/​ic_os/​config/​tool/​Cargo.toml Replaces networking and INI helpers.
rs/​ic_os/​build_tools/​partition_tools/​src/​ext.rs Replaces PCRE2 with Rust regex.
rs/​ic_os/​build_tools/​partition_tools/​Cargo.toml Replaces pcre2 with regex.
rs/​ic_os/​build_tools/​partition_tools/​BUILD.bazel Mirrors regex migration.
rs/​https_outcalls/​pricing/​Cargo.toml Removes direct slog dependency.
rs/​https_outcalls/​pricing/​BUILD.bazel Mirrors logging cleanup.
rs/​https_outcalls/​consensus/​Cargo.toml Removes unused logging and test dependencies.
rs/​https_outcalls/​consensus/​BUILD.bazel Mirrors consensus cleanup.
rs/​https_outcalls/​client/​Cargo.toml Removes unused logging and time helpers.
rs/​https_outcalls/​client/​BUILD.bazel Mirrors client cleanup.
rs/​https_outcalls/​adapter/​tests/​server_test.rs Replaces OnceCell with OnceLock.
rs/​https_outcalls/​adapter/​Cargo.toml Removes unused dependencies.
rs/​http_endpoints/​xnet/​Cargo.toml Removes unused logging and Prost dependencies.
rs/​http_endpoints/​xnet/​BUILD.bazel Mirrors XNet cleanup.
rs/​http_endpoints/​test_agent/​Cargo.toml Removes unused validator dependency.
rs/​http_endpoints/​test_agent/​BUILD.bazel Removes unused logging dependency.
rs/​http_endpoints/​public/​Cargo.toml Removes unused dependencies.
rs/​http_endpoints/​public/​BUILD.bazel Mirrors public endpoint cleanup.
rs/​http_endpoints/​nns_delegation_reader/​Cargo.toml Removes unused dependencies.
rs/​http_endpoints/​nns_delegation_reader/​BUILD.bazel Mirrors reader cleanup.
rs/​http_endpoints/​nns_delegation_manager/​Cargo.toml Removes direct slog dependency.
rs/​http_endpoints/​nns_delegation_manager/​BUILD.bazel Mirrors logging cleanup.
rs/​http_endpoints/​async_utils/​Cargo.toml Removes unused dependencies.
rs/​http_endpoints/​async_utils/​BUILD.bazel Mirrors async-utils cleanup.
rs/​fuzzers/​bitcoin/​fuzz_targets/​deserialize_bitcoin_transaction.rs Migrates Bitcoin import path.
rs/​fuzzers/​bitcoin/​fuzz_targets/​deserialize_bitcoin_raw_network_message.rs Migrates Bitcoin P2P import path.
rs/​fuzzers/​bitcoin/​BUILD.bazel Consolidates Bitcoin dependency.
rs/​execution_environment/​tools/​src/​icp_config.rs Replaces eyre with anyhow.
rs/​execution_environment/​tools/​Cargo.toml Migrates error dependency.
rs/​execution_environment/​tools/​BUILD.bazel Mirrors error dependency migration.
rs/​execution_environment/​tests/​hypervisor.rs Migrates gzip encoding to flate2.
rs/​execution_environment/​tests/​execution_test.rs Migrates gzip encoding to flate2.
rs/​execution_environment/​Cargo.toml Removes unused dependencies.
rs/​execution_environment/​BUILD.bazel Removes libflate.
rs/​execution_environment/​benches/​lib/​Cargo.toml Removes unused tempfile dependency.
rs/​execution_environment/​benches/​lib/​BUILD.bazel Mirrors benchmark cleanup.
rs/​embedders/​src/​wasm_utils/​decoding.rs Migrates gzip decoding to flate2.
rs/​embedders/​Cargo.toml Replaces libflate and removes workarounds.
rs/​embedders/​BUILD.bazel Mirrors embedder dependency changes.
rs/​embedders/​benches/​compilation.rs Migrates benchmark decompression.
rs/​dogecoin/​ckdoge/​minter/​Cargo.toml Removes unused PocketIC dependency.
rs/​dogecoin/​ckdoge/​minter/​BUILD.bazel Mirrors PocketIC removal.
rs/​dogecoin/​ckdoge/​agent/​Cargo.toml Removes unused ledger dependencies.
rs/​dogecoin/​ckdoge/​agent/​BUILD.bazel Mirrors agent cleanup.
rs/​depcheck/​src/​lib.rs Adapts to cargo-metadata types.
rs/​crypto/​test_utils/​csp/​Cargo.toml Removes unused crypto dependencies.
rs/​crypto/​test_utils/​csp/​BUILD.bazel Mirrors CSP utility cleanup.
rs/​crypto/​test_utils/​crypto_returning_ok/​Cargo.toml Removes unused test dependencies.
rs/​crypto/​test_utils/​crypto_returning_ok/​BUILD.bazel Mirrors crypto-test cleanup.
rs/​crypto/​temp_crypto/​Cargo.toml Removes unused async and RNG dependencies.
rs/​crypto/​temp_crypto/​BUILD.bazel Mirrors temp-crypto cleanup.
rs/​crypto/​node_key_generation/​Cargo.toml Removes unused test dependencies.
rs/​crypto/​node_key_generation/​BUILD.bazel Mirrors node-key cleanup.
rs/​crypto/​internal/​logmon/​Cargo.toml Removes unused case conversion dependency.
rs/​crypto/​internal/​logmon/​BUILD.bazel Mirrors dependency removal.
rs/​crypto/​internal/​csp_test_utils/​Cargo.toml Removes unused Serde dependency.
rs/​crypto/​internal/​csp_test_utils/​BUILD.bazel Mirrors Serde removal.
rs/​crypto/​internal/​crypto_service_provider/​src/​vault/​remote_csp_vault/​tests.rs Removes obsolete CPU comparison test.
rs/​crypto/​internal/​crypto_service_provider/​Cargo.toml Removes num_cpus.
rs/​crypto/​internal/​crypto_service_provider/​BUILD.bazel Mirrors CPU dependency removal.
rs/​crypto/​internal/​crypto_lib/​tls/​Cargo.toml Removes unused ChaCha RNG dependency.
rs/​crypto/​internal/​crypto_lib/​tls/​BUILD.bazel Mirrors RNG cleanup.
rs/​crypto/​internal/​crypto_lib/​threshold_sig/​canister_threshold_sig/​test_utils/​Cargo.toml Removes unused hashing dependencies.
rs/​crypto/​internal/​crypto_lib/​threshold_sig/​canister_threshold_sig/​test_utils/​BUILD.bazel Mirrors test utility cleanup.
rs/​crypto/​internal/​crypto_lib/​threshold_sig/​canister_threshold_sig/​Cargo.toml Removes unused Ed25519 dependency.
rs/​crypto/​internal/​crypto_lib/​threshold_sig/​canister_threshold_sig/​BUILD.bazel Mirrors Ed25519 removal.
rs/​crypto/​internal/​crypto_lib/​basic_sig/​cose/​Cargo.toml Removes unused Serde dependency.
rs/​crypto/​internal/​crypto_lib/​basic_sig/​cose/​BUILD.bazel Mirrors Serde removal.
rs/​crypto/​iccsa/​Cargo.toml Removes unused test dependencies.
rs/​crypto/​iccsa/​BUILD.bazel Mirrors ICCSA cleanup.
rs/​crypto/​for_verification_only/​Cargo.toml Removes unused TLS interfaces.
rs/​crypto/​for_verification_only/​BUILD.bazel Mirrors TLS dependency removal.
rs/​crypto/​Cargo.toml Removes numerous unused test dependencies.
rs/​canister_sandbox/​Cargo.toml Removes unused helper crates.
rs/​canister_sandbox/​BUILD.bazel Mirrors sandbox cleanup.
rs/​boundary_node/​salt_sharing/​integration_tests/​Cargo.toml Removes unused integration dependencies.
rs/​boundary_node/​salt_sharing/​integration_tests/​BUILD.bazel Mirrors salt-sharing cleanup.
rs/​boundary_node/​rate_limits/​integration_tests/​Cargo.toml Removes unused integration dependencies.
rs/​boundary_node/​rate_limits/​integration_tests/​BUILD.bazel Mirrors rate-limit cleanup.
rs/​boundary_node/​rate_limits/​Cargo.toml Removes unused integration-test dependency.
rs/​boundary_node/​rate_limits/​canister_client/​Cargo.toml Removes unused regex dependency.
rs/​boundary_node/​rate_limits/​canister_client/​BUILD.bazel Mirrors regex removal.
rs/​boundary_node/​rate_limits/​api/​Cargo.toml Removes unused API dependencies.
rs/​boundary_node/​ic_boundary/​Cargo.toml Removes unused signature utility.
rs/​boundary_node/​ic_boundary/​BUILD.bazel Mirrors signature dependency removal.
rs/​bitcoin/​mock/​Cargo.toml Removes unused Bitcoin test dependencies.
rs/​bitcoin/​mock/​BUILD.bazel Mirrors mock cleanup.
rs/​bitcoin/​ckbtc/​minter/​src/​address.rs Migrates tests to the workspace Bitcoin API.
rs/​bitcoin/​ckbtc/​minter/​Cargo.toml Consolidates Bitcoin and removes unused dependencies.
rs/​bitcoin/​ckbtc/​agent/​Cargo.toml Removes unused ledger dependencies.
rs/​bitcoin/​ckbtc/​agent/​BUILD.bazel Mirrors agent cleanup.
rs/​bitcoin/​adapter/​Cargo.toml Upgrades hashlink and removes unused dependencies.
rs/​bitcoin/​adapter/​BUILD.bazel Mirrors adapter dependency cleanup.
packages/​pocket-ic/​tests/​tests.rs Migrates Taproot APIs to workspace Bitcoin.
packages/​pocket-ic/​Cargo.toml Consolidates Bitcoin and removes unused dependencies.
packages/​pocket-ic/​BUILD.bazel Mirrors PocketIC dependency changes.
packages/​icrc-ledger-types/​Cargo.toml Removes Base32 dependency.
packages/​icrc-ledger-types/​BUILD.bazel Mirrors Base32 removal.
bazel/​pcre2-sys.patch Removes obsolete PCRE2 determinism patch.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@nmattia nmattia changed the title chore: simplify dpeendency graph chore: simplify dependency graph Sep 24, 2026
@nmattia
nmattia force-pushed the nm-dependency-cleanup branch from 431fdd0 to fe93ad7 Compare September 24, 2026 13:06
This removes a lot of small dependencies that are better inlined. By
inlining we remove a lot of transitive dependencies. This speeds up the
build and avoids a whole class of suply-chain attacks.
@nmattia
nmattia force-pushed the nm-dependency-cleanup branch from fe93ad7 to 0af52a6 Compare September 25, 2026 09:32
@nmattia
nmattia marked this pull request as ready for review September 25, 2026 10:22
@nmattia
nmattia requested review from a team as code owners September 25, 2026 10:22
github-actions[bot]

This comment was marked as spam.

@zeropath-ai

zeropath-ai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

✅ No security or compliance issues detected. Reviewed everything up to c2521b6.

Security Overview
Detected Code Changes

Diff information was unavailable for this scan.

@zeropath-ai

zeropath-ai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

✅ No security or compliance issues detected. Reviewed everything up to c2521b6.

Security Overview
Detected Code Changes

Diff information was unavailable for this scan.

@zeropath-ai

zeropath-ai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

✅ No security or compliance issues detected. Reviewed everything up to c2521b6.

Security Overview
Detected Code Changes

Diff information was unavailable for this scan.

@zeropath-ai

zeropath-ai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

✅ No security or compliance issues detected. Reviewed everything up to c2521b6.

Security Overview
Detected Code Changes

Diff information was unavailable for this scan.

@zeropath-ai

zeropath-ai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

✅ No security or compliance issues detected. Reviewed everything up to c2521b6.

Security Overview
Detected Code Changes

Diff information was unavailable for this scan.

@zeropath-ai

zeropath-ai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

✅ No security or compliance issues detected. Reviewed everything up to c2521b6.

Security Overview
Detected Code Changes

Diff information was unavailable for this scan.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The repository-wide dependency and API migrations require complete Cargo/Bazel analysis and targeted runtime validation before approval.

Review effort: Balanced
Findings: None

The crate added on master in #11619 only logs through ic_logger's macros,
which this branch changed to expand to `$crate::slog`, so the direct slog
dependency is no longer needed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The new duration parser silently narrows the supported metrics-proxy configuration syntax and can prevent existing configurations from starting.

Review effort: Balanced
Findings: 1 High severity

Open (1)

Comment thread rs/monitoring/metrics_proxy/README.md Resolved
@gregorydemay gregorydemay added the CI_ALL_BAZEL_TARGETS Runs all bazel targets label Sep 29, 2026
gregorydemay and others added 2 commits September 29, 2026 07:05
…ger and unit

duration-string also accepts compound durations such as `1m30s` or `1h 30m`,
as the 0.3.0 version used before this change did, so describing the format as
"an integer followed by a unit" undersold it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@basvandijk
basvandijk requested a balanced review from Copilot September 29, 2026 07:27
Comment thread rs/rosetta-api/icrc1/src/main.rs Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The broad dependency and behavior migrations across runtime, OS-image, cryptographic, and system-test components require final human validation.

Review effort: Balanced
Findings: 1 High severity

Open (1)

Comment thread rs/bitcoin/ckbtc/minter/BUILD.bazel Resolved
The ckBTC minter tests, the pocket-ic tests and the bitcoin fuzzers used
bitcoin 0.28.2 before this PR, which moved them to the workspace
`bitcoin` crate, i.e. the bitcoin-dogecoin fork. The Dogecoin
integration is going to be wound down, so keep them on bitcoin 0.28.2
rather than coupling them to the fork, as suggested in review:
#11669 (comment)

This restores their pre-PR code, their bitcoin 0.28.2 dev-dependency and
Bazel labels, the crate.spec, and the lock entries for bitcoin 0.28.2,
bech32 0.8.1, bitcoin_hashes 0.10.0, secp256k1 0.22.2 and
secp256k1-sys 0.5.2, all identical to master's. The PR's other changes
to these crates (unused-dependency removals) stay. So does the new
deserialize_dogecoin_raw_network_message fuzzer, which needs the fork
for its bitcoin::dogecoin types.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The duration parser narrows an external configuration format, and the replacement regex engine does not support the full SELinux file-context grammar.

Review effort: Balanced
Findings: None

Resolved since last review (1)
Previously missed (2)

In code that hasn't changed since last review

Medium severity Use a PCRE2-compatible engine for SELinux file contexts

rs/​ic_os/​build_tools/​partition_tools/​src/​ext.rs:3

FileContexts consumes the SELinux file_contexts file extracted from the GuestOS rootfs (ic-os/defs.bzl:158-163), whose pattern language is PCRE2. regex::bytes::Regex implements a smaller grammar and rejects valid PCRE2 constructs such as look-around and backreferences, so a policy update containing one of those patterns will make FileContexts::new fail and block image construction. Keep a PCRE2-compatible engine, or explicitly translate/validate the full SELinux pattern grammar before dropping this dependency.

Medium severity Preserve backward-compatible duration syntax in IC_CONFIG

rs/​tests/​driver/​src/​driver/​ic.rs:740

This changes the accepted syntax of the externally supplied system-test configuration. from_config.rs deserializes IC_CONFIG into IcConfig, whose complex subnet variant is Box<Subnet> (rs/tests/dre/utils/lib.rs:91-96), so existing values accepted by humantime-serde—for example "unit_delay": "1.5s" or units such as min—now fail under duration-string. Please retain the old grammar with a compatibility parser (and add a complex-subnet deserialization test) rather than making dependency cleanup break existing configurations.

@gregorydemay gregorydemay left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clean-up!

@basvandijk
basvandijk disabled auto-merge September 30, 2026 18:16
@basvandijk
basvandijk added this pull request to the merge queue Sep 30, 2026
Merged via the queue into master with commit 7b8819b Sep 30, 2026
41 checks passed
@basvandijk
basvandijk deleted the nm-dependency-cleanup branch September 30, 2026 18:59
AleDema pushed a commit to AleDema/ic that referenced this pull request Nov 18, 2026
…cies lint (dfinity#12165)

Rust 1.100.0 (dfinity#12143) brought Cargo's new
[`cargo::unused_dependencies`](https://doc.rust-lang.org/stable/cargo/reference/lints.html#unused_dependencies)
and `cargo::unused_workspace_dependencies` lints (warn by default). On
master,

```
cargo check --workspace --all-targets --all-features --keep-going
```

reports 30 unused `[dependencies]`/`[build-dependencies]` entries and
one unused `[workspace.dependencies]` entry. A run with default features
reports the same 31.

This PR removes the ones that are really unused. Where Bazel listed the
same dependency, the PR removes it from the `BUILD.bazel` file too; the
"already absent" rows below needed no Bazel change. It also removes the
`crate.spec` of each removed workspace dependency from
`bazel/rust.MODULE.bazel`.

The lint says nothing about a dependency while another dependency of the
same crate still pulls it in, so the removals exposed four more, which
this PR also removes:

- `rustc-hash` in `ic-nns-integration-tests`, previously also reachable
through its dev-dependency `ic-nervous-system-integration-tests`;
- `ic-types` and `icp-ledger` in `ic-sns-governance-api`, previously
also reachable through `ic-nns-common`;
- the workspace's `rustc-hash` entry, once no member inherited it.

In total the PR removes 21 `[dependencies]`, 2 `[build-dependencies]`
and 2 `[workspace.dependencies]` entries, and moves 4 entries to
`[dev-dependencies]`. After it, the command above reports only the six
false positives listed at the end, with default features as well.

A `[dependencies]` entry only counts as used if the library or a binary
(including their unit tests) uses it. The lint therefore also reports
dependencies that only integration tests (`tests/*.rs`) use. Deleting
those would break the tests, so they move to `[dev-dependencies]`
instead; the lint doesn't check that table.

### Removed

| Crate | Unused dependency | Bazel |
|---|---|---|
| `consensus-vetkd-system-tests` | `ic_consensus_system_test_utils` |
removed |
| `ic-boundary-nodes-performance-test-common` |
`ic-boundary-nodes-system-test-utils` | removed |
| `ic_consensus_system_test_utils` | `ic-http-utils` | removed |
| `ic-cup-explorer` | `ic-registry-client` | already absent |
| `ic-nervous-system-integration-tests` | `ic-nns-test-utils-macros` |
already absent |
| `ic-nervous-system-integration-tests` | `ic-test-utilities-load-wasm`,
`rustc-hash` | removed |
| `ic-nns-integration-tests` | `dfn_json`, `rustc-hash` | removed |
| `ic-nns-test-utils` | `ic-node-rewards-canister-api` | removed |
| `ic-node-rewards-canister-api` | `ic-nervous-system-proto` | already
absent |
| `rewards-calculation` | `ic-cdk`, `ic-nns-constants` | already absent
|
| `dfn_http_metrics` | `dfn_http` | already absent |
| `ic-sns-governance-api` | `ic-nns-common`, `ic-types`, `icp-ledger`,
`itertools` | already absent |
| `ic-sns-test-utils` | `ic-nns-governance` | already absent |
| `ic-validator-ingress-message-test-canister` | `build-info` | removed
|
| `ic-sns-governance` | build-dependencies `ic-base-types` and
`prost-build` (`build.rs` only calls `build_info_build`) | removed from
`BUILD_DEPENDENCIES` |
| `ic-dummy-getrandom-for-wasm` | `getrandom` on targets other than
`wasm32-unknown-unknown`, where all of the crate's code is compiled out
| `deps` became a `select()` on `wasm32-unknown-unknown` |
| workspace | `ring` (no member has inherited it since dfinity#11669) and
`rustc-hash` (no member inherits it after the removals above) |
`crate.spec`s removed |

### Moved to `[dev-dependencies]` (only integration tests use them)

| Crate | Dependency | Bazel |
|---|---|---|
| `ic-consensus` | `ic-consensus-certification` | removed from
`:malicious_consensus`; the test targets already list it |
| `ic-crypto-internal-seed` | `hex` | already only on
`:seed_integration` |
| `ic_stable_memory_integrity` | `canister-test` | already only on the
`rust_ic_test` |
| `ic-nervous-system-integration-tests` | `ic-sns-cli` | moved from the
shared list to the three `rust_test`s that use it |

### `ring` and `rustc-hash`

Both stay transitive dependencies in Cargo and in Bazel.

- **`ring`** comes in through `rcgen`, `x509-parser` and, on wasm32,
`quinn-proto`, so its `crate.annotation` stays. The removed `crate.spec`
was the only thing enabling ring's `std` feature in Bazel. Cargo already
builds ring without `std` (see `cargo tree -e features -i ring --target
all`), so after the repin Bazel matches Cargo. In ring 0.17.14, `std`
only adds `std::error::Error` impls for `error::Unspecified` and
`error::KeyRejected`.
- **`rustc-hash` 1.1.0** comes in through `bindgen`. Its `crate.spec`
enabled no features and it has no `crate.annotation`, so the repin only
drops it from the direct dependencies.

### Kept: false positives

The lint only sees code compiled for the host. These dependencies are
only used when compiling for wasm, so they stay:

- `ic0` in `canlog` (`#[cfg(target_family = "wasm")]`) and
`ic-canister-profiler` (`#[cfg(target_arch = "wasm32")]`)
- `ic-cdk` in `ic-nervous-system-time-helpers` (`#[cfg(target_arch =
"wasm32")]`)
- `ic-dummy-getrandom-for-wasm` in `cycles-minting-canister`,
`ic-ckbtc-minter` and `xnet-test`. Nothing references it in Rust code.
It turns on getrandom 0.2's `custom` feature, which `rand` needs to
compile for `wasm32-unknown-unknown` with Cargo.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
cameronraysmith pushed a commit to cameronraysmith/ic that referenced this pull request Nov 20, 2026
…xide 0.9.1 (dfinity#12191)

Updates flate2 from 1.1.9 (Cargo) and 1.1.5 (Bazel) to 1.1.11 in both
builds. Since 1.1.10, flate2's default backend is miniz_oxide 0.9
instead of 0.8, and the locks resolve it to miniz_oxide 0.9.1.

dfinity#12180 held flate2 back for this reason:
- miniz_oxide 0.9.1 rejects some deflate streams that 0.8.9 accepted.
- The replica decodes a canister's stored gzipped Wasm module again
whenever it compiles it, so an installed module could stop loading after
a replica upgrade.

This description sets out how far that risk goes. Whether to take it is
for the Execution team to decide (@dfinity/core-protocol, which owns
`rs/embedders`).

**Recommendation: take it.** A hit is very unlikely (see below). If one
happens, it is limited to that canister, it shows in the replica's
metrics, and a replica release that restores the old rule undoes it.

# What changes for gzipped canister modules

**One stream shape is newly rejected.**
- **The shape:** a dynamic Huffman block whose literal/length or
distance code gives a code to exactly one symbol, with a code length of
2 to 15.
- miniz_oxide 0.9.1 rejects the table as soon as it reads the block
header, even if the block never uses that code (Frommi/miniz_oxide#190,
which fixes Frommi/miniz_oxide#137). 0.8.9 accepted it.
- For the literal/length code this can only be an empty block whose one
code is end-of-block.
- **zlib already rejects it,** and so do GNU gzip and pigz. 0.9.1's
table checks follow zlib's `inflate_table` rule for rule.
- **No other acceptance change:** the 0.8.9 → 0.9.1 inflate diff changes
only this table check.
- In 11 million differential cases, every stream that 0.8.9 accepted and
0.9.1 rejected had this shape. 0.9.1 accepted nothing that 0.8.9
rejected, and streams both accepted decoded to the same bytes.
- Nothing else on the `decode_wasm` path changes which modules are
accepted.

**No common compressor produces that shape:**
- **At least two codes:**
- zlib and its derivatives (zlib-ng, zlib-rs, pako, Node), GNU gzip,
pigz, 7-Zip and ISA-L always emit at least two codes.
- So does libdeflate from 1.19. Earlier versions emit an empty code or
two 1-bit codes, which both versions accept.
- **A 1-bit code:** miniz, miniz_oxide, zopfli, libflate and Go's
compress/flate give a lone symbol a 1-bit code, which both versions
accept.
- **dfx** compresses with flate2 when `"gzip": true` is set and whenever
it rewrites a gzipped module. It has used miniz_oxide since 0.24.2
(dfinity/sdk#3958), and zlib-ng before that.
- **IC tooling:**
- Our canisters are gzipped with pigz. The bundled ic-btc-canister
release uses GNU gzip.
- The asset canister and Internet Identity use `gzip --best --no-name`.
  - icp-cli's recipes use `gzip --no-name`.
- **Experiments:** none of the encoders that could be run here produced
such a table. They were GNU gzip, pigz, busybox, 7-Zip, zlib via Python,
Node and Java, zlib-rs, libdeflate, zopfli, libflate, the deflate crate,
and miniz_oxide 0.8.9 and 0.9.1, directly and through flate2. The runs
covered:
  - 35,522 gzip streams from 57 edge-case and real inputs;
- 948,000 raw streams from 6,000 random inputs, using the Rust encoders.

  Go, ISA-L, pako and zlib-ng were checked in source only.

**None of the real modules we could obtain has it.** All 2,290 distinct
canister modules we found decode to identical bytes with flate2 1.1.5,
1.1.9 and 1.1.11. None of their 79,097 dynamic blocks has an incomplete
or single-symbol table. The modules came from:
- the history of `mainnet-canister-revisions.json` since 2024-10 (581
module hashes);
- DFINITY's CDN for 23 IC versions since 2023-01 (1,043 release
canisters);
- the asset canister and wallet bundled with dfx since 2022-08;
- 22 public IC projects' GitHub releases (529 assets);
- our current canisters, and the modules our Bazel build downloads as
test data.

**Most installed modules are not among them.** A sample of 3,000 mainnet
canisters from the public dashboard API had 843 with a module. Only 252
of those run one of the modules above, and 241 of the 252 are asset
canisters. Checking the rest needs the installed modules themselves.
Someone with access to a recent checkpoint could scan the canisters' and
snapshots' `software.wasm` files for the shape; this is the check dfinity#12180
asked for.

**If an installed module has the shape,** for example because it was
hand-crafted or fuzzed:
- **Its developer would not have noticed.** Today's decoder, miniz_oxide
0.8.9 (on mainnet since dfinity#11669 in October 2026), accepts it. So did
libflate, which the replica used before, and so do dfx, ic-wasm and
7-Zip.
- **After the replica upgrade:**
- Every message to the canister fails with IC0505
(`CanisterInvalidWasm`) on every node, and so do heartbeats and timers.
- The failure is deterministic, so there's no divergence between nodes
and no effect on the rest of the subnet.
- The canister still pays the fixed execution fee for each failed call,
callback and heartbeat. A canister that exports `canister_heartbeat`
pays it every round until it freezes, and a global timer that fires is
used up.
- **A normal upgrade fails too** if the module exports
`canister_pre_upgrade`, because the upgrade runs that hook from the old
module. The options:
- **Upgrade with `skip_pre_upgrade`:** this works and keeps stable
memory. It loses whatever `canister_pre_upgrade` would have saved, which
for canisters that serialize their heap in that hook is all heap state.
With enhanced orthogonal persistence, adding `wasm_memory_persistence =
keep` loses nothing.
- **Reinstall:** this also works, but wipes all state, stable memory
included.
- **Load a snapshot:** this should work without losing state, but is
untested. Take a snapshot, which doesn't decode the module. Download it,
replace its module with the same Wasm gzipped by a standard tool, upload
that as a new snapshot and load it.
- **No controller:** a canister without one can only be fixed by a
replica change.
- **Detection:** the replica counter
`sandboxed_execution_replica_cache_lookups` with `lookup_result`
`embedder_cache_hit_compilation_error` or
`compilation_cache_hit_compilation_error` counts executions that hit a
cached compilation error. A broken canister would make it rise after the
rollout.
- **Reversal:** nothing derived from the failed decode is persisted. The
module and the canister's memory stay as they are, and compilation
results, errors included, are only cached in memory and in a temporary
directory that is wiped when the replica starts. So a replica release
that restores the old rule makes the canister work again. Only the
effects of the failed messages remain: rejects, fees and used-up timers.

**Alternatives, if execution wants no change in what is accepted:**
- **Stay on flate2 1.1.9 / 1.1.5** (miniz_oxide 0.8.9).
- **Hold miniz_oxide at `=0.9.0`.** flate2 1.1.11 accepts it, and it
still has 0.8.9's rule; 0.9.1's only other changes affect wasm32. The
costs:
- No crate of ours depends on miniz_oxide directly, so this needs a
pinned direct dependency in `Cargo.toml` and a `crate.spec` in
`bazel/rust.MODULE.bazel`.
  - It moves backtrace's copy back from 0.9.1.
  - It only defers the decision.
- **Measure first.** Keep the old rule, ship a check in `decode_wasm`
that counts decoded modules with the rejected shape in a metric, and
switch once mainnet reports none for a release. The costs:
- `decode_wasm` runs in the compiler sandbox, so the count has to come
back with the compilation result.
- Modules are only decoded when a canister is installed or executes, so
idle canisters and stored snapshots stay unchecked.

# Other changes

- **Error text:** a gzip module whose deflate data is truncated, but
whose size trailer looks plausible, now fails with "failed to decode
compressed Wasm module: incomplete deflate stream". Before, it was "...:
unexpected end of file". The text appears in reject messages, and no
test asserts it. Most truncated uploads fail the module size check
before reaching flate2.
- **Raw-deflate and zlib decoders** now report truncated input as an
error instead of returning partial output, and zlib streams missing
their Adler-32 trailer now fail. Where this applies, all off-chain:
- **ICP Rosetta** (@dfinity/defi): request bodies with
`Content-Encoding: deflate` that are truncated or lack the trailer are
now rejected instead of parsed. Truncated gzip bodies only get a
different error. Bodies with the newly rejected table shape are rejected
too. ICRC Rosetta doesn't decompress requests.
- **ic-response-verification's raw `DeflateDecoder`,** for v1-certified
`deflate` responses. It runs in PocketIC's HTTP gateway and in the
ic-gateway binary that GuestOS ships for cloud engine nodes.
- **Other gzip decoders:** two places use the same gzip decoder on
inputs from standard compressors:
- the `.tar.gz` branch of `ic-http-utils`' archive extraction, which
only the orchestrator calls, to fetch the registry store during subnet
recovery;
  - PocketIC.
- **Compression:**
- **Unchanged:** one-shot gzip and raw-deflate output is byte-identical
at every level.
  - **Changed:**
- zlib-wrapped output at level 0 changes only its 2-byte header (`08 1D`
→ `78 01`);
    - output in flush edge cases;
    - output of `read::GzEncoder` and `bufread::GzEncoder` at level 1.
- **Production use:** production code compresses with flate2 only for
ic-boundary's and ic-gateway's `/metrics` responses, through tower-http
at the default level. Nothing stores, hashes or certifies those bytes.
No production canister links flate2, so all 44 canisters in
`//publish/canisters` are byte-identical with and without this change
(PR base 4b4fc5d).
- **Requirements and locks:**
- flate2's requirement goes from `1.0.31` to `1.1.11` in `Cargo.toml`
and `bazel/rust.MODULE.bazel`.
  - miniz_oxide 0.8.9 drops out of both locks.
- zlib-rs 0.6.8, an optional flate2 backend, appears in them but isn't
built.
- miniz_oxide 0.9.1 gains its `default`, `simd` and `with-alloc`
features, which backtrace's copy now also gets.
- flate2's new default feature `runtime_detection` only enables
crc32fast's `std` feature, which was already on.
  - No other package changes version.

# Verification

- **Locks:** in the dev container, `cargo update --workspace` reports
"Locking 0 packages". `./bin/bazel-pin.sh` reports "Nothing to repin.",
and `MODULE.bazel.lock` doesn't change.
- **Lint:** `./ci/scripts/rust-lint.sh` passes.
- **Tests:** these pass on the rebased head:
  - `//rs/embedders:embedders_test`;
  - `//rs/embedders:embedders_integration_tests/misc_tests`;
-
`//rs/execution_environment:execution_environment_misc_integration_tests/execution_test_test`,
which installs gzipped modules;
  - the `//rs/http_utils` tests.
- **Evidence:** the figures above come from:
- differential tests of miniz_oxide 0.8.9 and 0.9.1 and of flate2 1.1.5,
1.1.9 and 1.1.11 against zlib;
  - encoder experiments;
  - decoding the module corpus;
  - the dashboard sample;
  - local builds of `//publish/canisters` with and without this change.

For each part except the dashboard sample, a second AI agent re-checked
the first one's findings with its own code and runs. The figures above
include its corrections. The scripts and raw results are not in the
repo.

This PR carries the `CI_ALL_BAZEL_TARGETS` label.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants