Repository navigation
chore(deps): refresh the replica runtime: wasmtime 48.0.9 and the TLS stack - #12180
Merged
basvandijk merged 3 commits intoNov 19, 2026
Merged
Conversation
…S stack Release the replica-runtime crates that the lockfile refresh held back, to their newest semver-compatible versions in both lock sets: wasmtime/pulley 48.0.9 with cranelift 0.135.9 and regalloc2 0.15.3 (the 48 LTS line), flate2 1.1.11, and the TLS stack: aws-lc-rs 1.19.0 (aws-lc-sys 0.47.0), rustls-webpki 0.103.17, webpki-roots and webpki-root-certs 1.0.12, rustls-pki-types 1.16.0, tokio-rustls 0.26.6, hyper-rustls 0.27.10, rustls-native-certs 0.8.5 (openssl-probe 0.2.2), async-web-client 0.6.4, brotli 8.0.4 and brotli-decompressor 5.0.3. Lock-only. wirm stays at 4.0.4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
flate2 1.1.10 moves its decoder to miniz_oxide 0.9, which, like zlib, rejects incomplete Huffman trees that 0.8 accepted (miniz_oxide#190). The replica decompresses a canister's stored .wasm.gz again whenever it compiles it, so a module that only the old decoder accepts would stop loading after an upgrade. Keep flate2 at the versions the lockfile refresh holds (1.1.9 in Cargo, 1.1.5 in Bazel) and leave the upgrade to its own PR. Also restore the socket2 and itertools edges of quinn, quinn-udp and alloy-rpc-types-eth in Cargo.lock, which re-resolving the TLS crates had moved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
basvandijk
marked this pull request as ready for review
November 19, 2026 08:39
Contributor
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.
rzakrzyk
approved these changes
Nov 19, 2026
q-uint
pushed a commit
to Swiss-Subnet/ic
that referenced
this pull request
Nov 19, 2026
…nity#12181) Stacked on dfinity#12180 (on dfinity#12178, on dfinity#12177). Bumps 32 crates across a semver-major version whose APIs, as we use them, are unchanged: only the requirements in `Cargo.toml` (workspace or crate-local) and `bazel/rust.MODULE.bazel` change, plus the locks and one deleted Bazel patch. Each group is a separate commit in this PR (squashed on merge), so a failure can be bisected to a group. # Changes | Group | Crates | |---|---| | Networking and system | tower-http 0.6 → 0.7, socket2 0.5 → 0.6, tokio-metrics 0.4 → 0.5, lru 0.12 → 0.19, hashlink 0.10 → 0.12 (bitcoin adapter), netdev 0.46 → 0.47, nix 0.31 → 0.32, procfs 0.17 → 0.18, signal-hook 0.3 → 0.4; in Bazel only, syscalls 0.6 → 0.8 (fuzzer) | | Data and encoding | bit-vec 0.6 → 0.10, zstd 0.13 → 0.14, base64 0.22 → 0.23, pem 3 → 4, ripemd 0.1 → 0.2 (ckBTC minter), rlp 0.5 → 0.6 (ckETH minter) | | tarpc | the dfinity fork (0.37 plus an opentelemetry 0.32 bump) → crates.io 0.38.0, which includes that bump. Once 0.38.0 was released, the fork was kept only so tarpc wouldn't pull in syn 3, which dfinity#12177 allows. | | askama | 0.15 → 0.16.1. `bazel/askama.patch` and its annotation are deleted: since 0.16.0, askama resolves template paths with `std::path::absolute` instead of `canonicalize()` (askama-rs/askama#720), as the patch did. The patch's other hunk, which stopped canonicalizing the path of an `askama.toml`, is not upstream, but no crate here has an `askama.toml` or a `config` template attribute. | | Test, tooling and Rosetta | tokio-tungstenite 0.29 → 0.30, jsonrpc 0.20 → 0.21, alloy-consensus/-eips/-rpc-types-eth 1.8 → 2.6 (ckETH test oracle), proptest-derive 0.5 → 0.9, rstest 0.19 → 0.28 (with default features off: its `crate-name` feature looks for `Cargo.toml`, which Bazel doesn't provide), walrus 0.26 → 0.28 (PocketIC server tests; ic-wasm keeps its own 0.26), object 0.37 → 0.41 (fuzzing), escargot 0.5 → 1.0, scraper 0.24 → 0.29, colored 2 → 3, dialoguer 0.11 → 0.12, and indicatif 0.17 → 0.18 (the ICP Rosetta server's block-sync progress bar; ICRC Rosetta also depends on it) | Where another crate still depends on the old major, both majors stay in the locks: hashlink, lru, procfs, signal-hook, bit-vec, ripemd, rlp, tokio-tungstenite, colored and walrus gain the new major next to the old one, and tower-http 0.6, nix 0.31, zstd 0.13, base64 0.22 and pem 3 stay next to their new major, which other crates had already pulled in. socket2 0.5.10, console 0.15 and a few html5ever-era crates drop out; with socket2 0.5 gone, quinn and quinn-udp use socket2 0.6.5 in both lock sets. ## Not in this PR wycheproof stays at 0.6. wycheproof 0.7 adds Ed25519 vector tc 151, whose R encodes y = 1 with the sign bit of x set; RFC 8032 (Section 5.1.3) says decoding it must fail. `packages/ic-ed25519` accepts it on purpose: its `verify_signature` follows ZIP215, which does not require canonical encodings of R and A, and the crate's own ZIP215 test vectors include this R. `rs/crypto/internal/crypto_lib/basic_sig/ed25519` delegates to it, so both crates' Wycheproof tests fail with 0.7. Moving to 0.7 needs those tests to skip the vector as a known ZIP215 difference, a test change that goes into its own PR. # Behaviour changes (FYI) - **tower-http 0.7**: CORS no longer sets a default `Vary` header. Compression follows RFC 9110 for `*` and `identity;q=0` in `Accept-Encoding`: ic-boundary's `/metrics` endpoint now answers 406 Not Acceptable when a request rules out every encoding, identity included, and serves zstd to `Accept-Encoding: *`. - **socket2 0.6** is used for the replica's QUIC socket (`rs/p2p/quic_transport`); the calls we make are unchanged. - **zstd 0.14**: state sync, ic-http-utils, partition_tools and the system-test driver move from zstd 0.13.5 to 0.14.4. Both bundle libzstd 1.5.7 (zstd-sys 2.1.3), and 0.13.5 stays in the locks through ic-bn-lib and build-info. - **lru 0.19** moves ic-utils-lru-cache and ic-utils-mem-lru off lru 0.12, which RUSTSEC-2026-0002 and RUSTSEC-2026-0253 flag (informational, for `IterMut` and `pop()`, which we don't use). lru 0.12.5 stays through ratatui 0.29. - **askama 0.16** drops our patch; CI's Build Determinism job checks that the dashboards still build reproducibly. # Verification Run locally on this branch: - In the dev container, `cargo update --workspace` reports "Locking 0 packages" and `./bin/bazel-pin.sh` reports "Nothing to repin."; `bazel run //bazel:buildifier.check` passes. - `./ci/scripts/rust-lint.sh` passes. - `bazel build` of the replica, the canister sandbox, ic-boundary, the bitcoin adapter, the ckBTC and ckETH minters, the PocketIC server, the dfx-core-vendored crates, the memory tracker, the replicated state and the crypto service provider (128 targets) succeeds. - All 18 Wycheproof test targets pass with wycheproof 0.6. - `bazel build --config=fuzzing --build_tag_filters=libfuzzer //rs/...` succeeds. This PR carries the `CI_ALL_BAZEL_TARGETS` label, so CI Main's Bazel Test All builds and tests the same targets as on master, `long_test`s included. CI Main's fuzzer job only runs on PRs that touch `.rs`, `BUILD.bazel`, `.bzl` or fuzzing CI files, so it skips this PR; the merge queue runs it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
q-uint
pushed a commit
to Swiss-Subnet/ic
that referenced
this pull request
Nov 19, 2026
…two Bazel patches (dfinity#12184) Stacked on dfinity#12181 (on dfinity#12180, on dfinity#12178, on dfinity#12177). This PR updates cc, the library that build scripts use to compile bundled C, C++ and assembly, for example in ring, aws-lc-sys, zstd-sys, libssh2-sys and wasmtime, and in the canister sandbox's own `backtrace.c`. It also updates three crates that wrap C or C++ libraries: ssh2 (Bazel only), libcryptsetup-rs, and rocksdb (macOS only). Two Bazel patches are deleted because their fixes are upstream. Each group is a separate commit in this PR (squashed on merge). # Changes | Group | Change | |---|---| | cc | 1.2.67 → 1.11.2. The requirement goes from `~1.2` to `1.11` in the `cc` crate.spec and in `rs/canister_sandbox/Cargo.toml` (that crate's build script compiles `src/backtrace.c` with cc). dfinity#12177 set `~1.2` to keep this jump out of it. | | ssh2, libssh2-sys | In Bazel, 0.9.4 → 0.9.7 and 0.3.0 → 0.3.4, the versions `Cargo.lock` already has. The floor is raised to 0.9.7, which requires libssh2-sys 0.3.4. `bazel/libssh2-sys.patch` is deleted: it stopped libssh2-sys from writing a `libssh2.pc` that contains the absolute OUT_DIR (rust-lang/ssh2-rs#340). 0.3.4 writes the paths relative to `${pcfiledir}` (rust-lang/ssh2-rs#366), and rules_rust's build-script runner deletes `*.pc` files from OUT_DIR anyway. The annotation's openssl `build_script_data` stays, because libssh2-sys still compiles against the `@openssl` headers. | | libcryptsetup-rs | 0.15.1 → 0.16.1 (libcryptsetup-rs-sys 0.6.1 → 0.7.0), floor 0.16.1. `bazel/libcryptsetup-rs.patch` and its annotation are deleted, because both of its fixes are upstream. 0.16.0 handles a null PBKDF hash (stratis-storage/libcryptsetup-rs#477); `CryptPbkdfType::hash` is now an `Option<String>`, which nothing here reads. 0.16.1 compares `CryptLuks2TokenHandle::is_assigned`'s return value with `-ENOENT` (stratis-storage/libcryptsetup-rs#483); guest_disk doesn't call it. | | rocksdb | 0.22.0 → 0.25.0 (librocksdb-sys 0.16.0+8.10.0 → 0.19.0+11.8.1, RocksDB 8.10 → 11.8). It is the artifact pool's optional backend and is only built on macOS. librocksdb-sys 0.19 no longer always builds bindgen with its `runtime` feature, which loads libclang at run time. rocksdb 0.25 turns librocksdb-sys's default features off and enables `bindgen-runtime` through its own default features. Our default features stay off, so `bindgen-runtime` is now enabled explicitly. That matters for Cargo; in Bazel, bindgen already gets `runtime` through other crates. The librocksdb-sys annotation gains `CXXFLAGS`; see the macOS section below. | The locks lose the crates that only the old versions used: - bindgen 0.69.5, lazycell and rustc-hash 1.1.0 (librocksdb-sys 0.16); - in Bazel, bitflags 1.3.2, parking_lot 0.11.2, parking_lot_core 0.8.6, instant and redox_syscall 0.2.16 (ssh2 0.9.4). They gain rustflags 0.1.7, a librocksdb-sys build dependency. No other dependency edge or feature changes in any of the three lock files. **Why the cc floor is `1.11` rather than `1`:** - With `1`, the locked 1.2.67 would still satisfy the requirement, so a plain `./bin/bazel-pin.sh` would keep it. - Moving it would then take a precise `./bin/bazel-pin.sh cc`. In the Bazel lock that also moves tempfile from getrandom 0.4.3 to 0.3.4, and cssparser-macros from syn 3 to syn 2. - With `1.11`, the plain repin has to move cc, as cargo did for `Cargo.lock`, and nothing else moves. Both locks pin 1.11.2. The PR also notes, in the worked examples of the fix-build-determinism skill (`.claude/skills/`), that the askama patch (removed in dfinity#12181) and the libssh2-sys patch no longer exist. ## macOS: RocksDB needs C++20 **The problem:** RocksDB 10.7 and later need C++20, and librocksdb-sys 0.19 passes `-std=c++20`. But Bazel's C++ toolchains add `-std=c++17` to C++ compiles. On macOS, Bazel uses apple_support's Xcode toolchain, whose default `BAZEL_CXXOPTS` is `-std=c++17`; the hermetic LLVM toolchain on Linux adds it too. rules_rust passes the toolchain's C++ flags to build scripts as `CXXFLAGS`, and cc adds `CXXFLAGS` after the build script's own flags. Without a fix, the last `-std` would be `-std=c++17`, and RocksDB 11.8 doesn't compile that way. **The fix:** the librocksdb-sys annotation sets `CXXFLAGS` to `-std=c++20`. rules_rust appends it to the toolchain's `CXXFLAGS`, which makes it the last `-std`. The alternatives don't work: - librocksdb-sys's own `ROCKSDB_CXX_STD` only replaces its builder flag, which still comes before `CXXFLAGS`. - `--cxxopt` doesn't reach build scripts. - `BAZEL_CXXOPTS` would change every macOS C++ compile. Cargo builds need no fix, since Cargo sets no `CXXFLAGS`. **Where it's tested:** Linux CI never compiles rocksdb. CI Main's Bazel Test arm64-darwin job does, on every PR run. On this PR it built pocket-ic for arm64 and x86_64 macOS, and `//rs/...`, with the fix. # Behaviour changes (FYI) - **cc 1.11:** - **Optimized builds** (`-c opt`, which everything we publish uses): no compiler or archiver flag is added or removed on our platforms. Some flags change order, and the names of the object files inside the static archives change. - **Cache:** those archives, and the rlibs that bundle them, change, so everything downstream misses the cache once. - **Outputs:** the linked outputs don't change. The replica, canister sandbox, compiler sandbox and sandbox launcher binaries, and all 44 canisters in `//publish/canisters`, are byte-identical to the ones built from dfinity#12181. That was checked for x86_64 Linux and wasm32; for aarch64 and macOS it rests on reading cc's source. - **Non-optimized builds** (`-c dbg`, and `-c fastbuild` as used by `--config=dev`) gain `-mno-omit-leaf-frame-pointer`, which changes the C object code on aarch64. - **Fuzzing:** under `--config=fuzzing` no sanitizer flag reaches build scripts, so cc's new ASan forwarding doesn't apply. - **libssh2** (Bazel only). It is the SSH client of the system-test driver (including the colocated-test wrapper in `rs/tests/idx`), the consensus tests, the mainnet-NNS testnet tool and the bare-metal deployment tool; nothing we ship links it. libssh2-sys 0.3.4 bundles a libssh2 snapshot from 2026-11-05 (1.11.2_DEV) instead of one from 2022 (1.10.1_DEV). @dfinity/core-protocol @dfinity/node - **Negotiation:** - **GuestOS and HostOS** (OpenSSH 10.2p1; SetupOS disables sshd): the client now picks an ed25519 host key instead of ECDSA, and chacha20-poly1305 instead of aes128-ctr with hmac-sha2-256. It also negotiates strict key exchange (the Terrapin mitigation). - **Universal and Prometheus VMs** (OpenSSH 10.5p1 on NixOS): the host key was already ed25519, so only the cipher and strict key exchange change. - **Key exchange** stays curve25519-sha256 everywhere. libssh2 enables ML-KEM only with OpenSSL 3.5 or later, and Bazel links 3.4.0. - **Our code doesn't notice:** nothing here checks host keys or pins algorithms. - **Re-keying:** with chacha20-poly1305, OpenSSH re-keys every 1 GiB per direction instead of every 64 GiB. - **What re-keys now:** a session that moves more than that re-keys mid-transfer. That covers: - bare-metal deployments that upload a HostOS upgrade image and a GuestOS image in one session; - the colocated tests' runtime-deps tarball, if it's that large; - the Prometheus data download. - **Not in this PR's CI:** none of these runs here. - **Evidence it works:** the snapshot contains libssh2's fix for the deadlock that a re-key during a partially sent packet caused. Locally, with the Bazel-built libssh2-sys 0.3.4 against OpenSSH 9.6p1, 1.5 GiB and 2.5 GiB scp uploads re-keyed once and twice respectively, and completed. - **Bare-metal risk:** the bare-metal deployment tool sets no SSH session timeout, so if a re-key ever stalls there, the tool hangs instead of failing. - **Interrupted calls:** a blocking call that a signal interrupts is now retried instead of failing with a timeout error. - **Algorithms:** SHA-1, MD5, DSA and the legacy ciphers are off by default; our servers use none of them. The ed25519 and RSA keys the tests use authenticate as before (RSA signs with rsa-sha2-512 in both versions). - **libcryptsetup-rs-sys 0.7** (GuestOS disk encryption). guest_disk uses it, and so do the orchestrator and the guest_upgrade client through it. @dfinity/node @dfinity/core-protocol - **Bindings:** the sys crate now generates its bindings with bindgen's clang macro fallback. I generated the 0.6.1 and 0.7.0 bindings in the dev container and compared them: - the 147 functions and 114 types (97 aliases, 17 structs) are the same, with the same signatures; - no constant changes type or value; - 51 flag constants now carry their C names (e.g. `CRYPT_ACTIVATE_READONLY` instead of `crypt_activate_readonly`), which libcryptsetup-rs maps to the same typed flags guest_disk uses; - the fallback also adds 35 constants that nothing uses (23 `CRYPT_*` and 12 integer limits such as `INT64_MAX`); - the `extern "C"` blocks become `unsafe extern "C"`. - **Tests:** guest_disk's tests, which `//rs/tests/node:root_tests` runs, read an Argon2i keyslot's PBKDF settings. That is the null-hash case the deleted patch handled. - **rocksdb 0.25** (macOS, and only with `consensus_pool_backend = "rocksdb"`). LMDB is the default, and in this repository only a test helper selects RocksDB, with temporary directories. @dfinity/core-protocol - **Disk format:** RocksDB 11.8 reads databases written by 8.10, but writes SST format version 7, which RocksDB before 10.4 can't read. The replica empties its persistent pool whenever its version changes, so that doesn't matter. - **Block cache:** the pool configures none, so RocksDB's default is used, and that default is now a HyperClockCache instead of an LRUCache. - **Compaction filter:** it is now freed with the database instead of leaked. - **PocketIC:** the published macOS PocketIC server links RocksDB 11.8 through the artifact pool, but never selects that backend. - **Tests:** no CI job runs the RocksDB pool tests. On Linux they are compiled out, and the arm64-darwin job only runs tests tagged `test_all_platforms` or `test_all_platforms_slow`. # Verification **CI** on fe09fb9 passed: - Bazel Test All: "Executed 215 out of 1163 tests: 1163 tests pass"; - Bazel Test arm64-darwin and arm64-linux; - Build IC and Build Determinism; - Cargo Lint, Lock Generate and the MODULE.bazel.lock check. **Locally**, on this branch: - **Locks:** - In the dev container, `cargo update --workspace` reports "Locking 0 packages". - `./bin/bazel-pin.sh` reports "Nothing to repin.". - `bazel mod deps` leaves `MODULE.bazel.lock` unchanged, and buildifier passes. - Compared with dfinity#12181's locks, only the edges of the crates above change. - **Builds:** - `bazel build` succeeds for the replica, the canister sandbox binaries, the system-test driver, the consensus test utilities, the bare-metal deployment tool and `//publish/canisters`. - `bazel build --config=fuzzing --build_tag_filters=libfuzzer //rs/...` succeeds. - The four binaries and the 44 canisters are byte-identical to the ones built from dfinity#12181. - **guest_disk:** `bazel build //rs/ic_os/os_tools/guest_disk/...` succeeds in the dev container, which has the cryptsetup libraries. The libcryptsetup-rs-sys build script leaves only `bindings.rs` in OUT_DIR, so the macro fallback's temporary files don't reach Bazel's outputs. - **Not run:** nothing was run locally on macOS. This PR carries the `CI_ALL_BAZEL_TARGETS` label. CI Main's Bazel Test All therefore builds and tests the same targets as on master, including the `long_test`s and the system tests' SSH sessions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #12178, which is stacked on #12177. #12177 refreshes both lock sets but holds the replica runtime back; this PR releases those holds, except flate2 and wirm (see Still held). It only changes the lock files.
Changes
Both
Cargo.lockandCargo.Bazel.{toml,json}.lockmove to the newest semver-compatible versions:wasmtime-internal-*crates, pulley-interpreter, pulley-macroscranelift-*crateswasmtime stays on the 48 LTS line. aws-lc-sys and, in Bazel, openssl-probe cross a 0.x boundary because aws-lc-rs 1.19.0 and rustls-native-certs 0.8.5 require it.
The new versions also drop three duplicates: hyper-rustls 0.27.10 uses rustls-platform-verifier 0.7.1, so 0.6.2 and rustls-platform-verifier-android 0.1.1 go; async-web-client 0.6.4 uses webpki-roots 1.0.12, so the 0.26 copy goes.
Re-resolving also changes some dependency edges of crates whose versions stay. In the Bazel lock, quinn and quinn-udp, which the replica's QUIC transport uses, go back from socket2 0.6.5 (as #12178 has them) to 0.5.10 (as #12177 has them);
Cargo.lockkeeps 0.6.5. Both are within their>=0.5, <0.7requirement, and the next PR in the stack removes socket2 0.5.10. The other edge changes follow the moved TLS crates, or are Windows-only windows-sys edges.Still held
.wasm.gzagain whenever it compiles it (rs/embedders/src/wasm_utils/decoding.rs), so a module that only the old decoder accepts would stop loading after an upgrade. zlib never produces such trees, but the upgrade needs its own PR, ideally with a check of the gzipped modules installed on mainnet.Behaviour changes (FYI)
@dfinity/core-protocol (execution, crypto, networking), FYI @dfinity/node for the boundary node and HostOS/GuestOS components.
wasmtime 48.0.8 and 48.0.9 are security patch releases. None of their 13 advisories applies to the replica's configuration:
wasm_gc(false).gcfeature, which we enable.threadsfeature; we never enable it.Caller::get_module_export, which we don't call.48.0.8 also fixes a Cranelift compile panic when one function touches more than ~32k data segments ([48.0.x] Use one alias region per runtime-data array bytecodealliance/wasmtime#15050).
webpki-roots 1.0.12 (from 1.0.6) removes 28 roots and adds 4. Among the removed are DigiCert Global Root CA, DigiCert High Assurance EV Root CA and GTS Root R2; ISRG Root X1/X2 (Let's Encrypt) stay. On CloudEngine subnets the replica uses this store to authenticate the API boundary node it fetches the NNS delegation from (
nns_delegation_manager). Together with webpki-root-certs 1.0.12, which ic-gateway's HTTP client trusts through ic-bn-lib, this fixes RUSTSEC-2026-0381 and RUSTSEC-2026-0383 (theemSign ECC Root CA - G3root of distrusted emSign intermediates).rustls-pki-types 1.16 strips a trailing dot from
DnsName/ServerName, and rejects names whose last label is0xor0Xfollowed only by hex digits (e.g.example.0x1f), which could be read as an IPv4 address. hyper-rustls applies this to HTTPS-outcall host names.aws-lc-rs 1.19 / aws-lc-sys 0.47 update the AWS-LC crypto library (5.7.0 → 5.12.0) used by rustls in the replica's TLS.
rustls-native-certs 0.8.5 / openssl-probe 0.2.2 (Bazel: from 0.8.0 / 0.1.5) change how the system CA store is found and loaded: a fixed Linux list instead of scanning 16 prefixes, every file in the certificate directories (deduplicated by inode) instead of only hash-named files,
SSL_CERT_DIRas a:-separated list, and no fallback to the system store onceSSL_CERT_FILEorSSL_CERT_DIRis set. Besides the HTTPS-outcalls adapter, this is the root store of every reqwest client through rustls-platform-verifier, including the orchestrator's GuestOS upgrade-image and subnet-recovery downloads and HostOS's upgrade download. On Ubuntu-based images the same bundle loads.brotli-decompressor 5.0.3, which rustls uses for certificate compression in node-to-node TLS, rejects streams with non-zero final padding.
async-web-client 0.6.4 is the HTTP client of rustls-acme, which ic-boundary uses through ic-bn-lib for TLS-ALPN-01. Its only change is a new default root store (webpki-roots 1.x), which rustls-acme never uses because it passes its own
ClientConfig.Verification
Run locally on this branch:
cargo update --workspacereports "Locking 0 packages" and./bin/bazel-pin.shreports "Nothing to repin."../ci/scripts/rust-lint.shpasses, andbazel buildof the replica, the canister sandbox,//rs/embedders:all, the HTTPS-outcalls adapter, ic-boundary, the orchestrator and the PocketIC server succeeds. The node key and TLS certificate validation tests pass.bazel build --config=fuzzing --build_tag_filters=libfuzzer //rs/..., which PR CI doesn't build for lock-only changes, succeeds.This PR carries the
CI_ALL_BAZEL_TARGETSlabel, so CI Main builds and tests the same targets as on master,long_tests included.🤖 Generated with Claude Code