Skip to content

feat(outcalls): cancel bounded-wait HTTP outcalls at their deadline - #11932

Merged
eichhorl merged 7 commits into
masterfrom
eichhorl/outcall-deadline-cancellation
Nov 13, 2026
Merged

eichhorl merged 7 commits into
masterfrom
eichhorl/outcall-deadline-cancellation

Conversation

@eichhorl

@eichhorl eichhorl commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

When a bounded-wait call to http_request or flexible_http_request expires, the caller's callback gets SYS_UNKNOWN, but the outcall itself keeps going. Until it finishes (up to the adapter's 30 s or consensus's 60 s timeout), the subnet keeps its context, its in-flight slot and its reserved response slot in the queue to the caller. So the deadline frees nothing on the subnet's side.

This PR cancels a bounded-wait outcall a second after its deadline:

  • One timeout rule. CanisterHttpRequestContext::effective_deadline() is a second past the caller's deadline, or the existing 60 s after the request was made if that comes first. The deadline is part of the request in the replicated context, so all nodes agree. Guaranteed-response calls keep the 60 s.
  • Consensus times an outcall out once its effective_deadline() has passed, both when building the payload and in the two validation checks.
  • The replica's client caps the adapter call at the same time, so nodes stop the HTTP request and free their adapter capacity. CanisterHttpRequest now carries the time of the replicated state it was dispatched from, and the client's budget is the time from there to effective_deadline(). A request the pool manager dispatches late, e.g. after a full client queue, only gets what's left, and one that has already timed out isn't started. Measuring in subnet time rather than by the node's clock also keeps this working under PocketIC's arbitrary test clocks. A timeout caused by the request's own time limit is reported as "Deadline Exceeded" rather than "Insufficient cycles".

Behavior changes:

  • The caller gets SYS_UNKNOWN, as for any bounded-wait call that runs out. Each round expires callbacks, to the second, before it processes consensus's responses, so the extra second means the callback has always expired by the time the timeout is processed. Without it, the timeout's SYS_TRANSIENT "Canister http request timed out" would reach the caller first on most mainnet subnets (2–3 blocks/s), but not on slower ones. SYS_UNKNOWN is also the accurate code: the request may have reached the server, whereas SYS_TRANSIENT counts as a clean reject. A timeout close to 60 s still hits the protocol timeout first and gets SYS_TRANSIENT, as a guaranteed-response call does.
  • Under pay-as-you-go pricing, an expired outcall is charged only up to a second past its deadline.
  • In PocketIC, bounded-wait outcalls now time out in the first round after PocketIC's time is more than a second past their deadline.
  • Replicas that haven't started a bounded-wait outcall by a second past its deadline no longer send it.
  • For guaranteed-response calls, the client's 60 s limit now counts from when the request was made rather than when it was dispatched, matching consensus's timeout. The adapter's 30 s timeout still applies first.

Tests:

  • effective_deadline(): the earlier of the 60 s and a second past the deadline.
  • Payload builder: a bounded-wait context times out once a second past its deadline has passed, but not at that point, including flexible outcalls.
  • Pool manager: a dispatched request carries its state's time.
  • Client: the request's time limit caps the adapter call and is reported as such, a timed-out request isn't sent, and a request dispatched shortly before its deadline only gets the time that's left.
  • End to end (bounded_wait_http_requests_are_cancelled_at_deadline): a canister fills its queue to its subnet with 500 bounded-wait outcalls that never get a response. With rounds 300 ms apart, as on mainnet, all callbacks get SYS_UNKNOWN, and the outcalls are timed out in the same round. The late rejects are dropped with their refunds credited, and a new outcall goes through right away. The test fails with the consensus change reverted, and without the extra second the callbacks get SYS_TRANSIENT instead. It needs the real payload builder, which StateMachine only runs in execute_round() on a subnet built with build_with_subnets, hence the two new test dependencies.
  • System test (canister_http_time_out_test): a bounded-wait outcall with a 5 s timeout to a server that answers after 40 s is timed out by consensus. On master the adapter's 30 s timeout ends it with a response instead, and the test fails.

Follow-up: describe the cancellation in the interface spec.

🤖 Generated with Claude Code

Time out a bounded-wait outcall in consensus once the caller's deadline has
passed, and cap the replica's adapter call at the same deadline, so that an
expired call no longer holds the caller's and the subnet's queue slots until
the outcall finishes.

Co-Authored-By: Claude Opus 5.5 <[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.

🟡 Changes recommended

Delayed dispatch can still send expired outcalls and exceed their deadlines, and the new test helper leaks its state machine through a reference cycle.

2 open issues
What changed in this PR

This PR adds deadline-based cancellation for bounded-wait HTTP outcalls, aiming to release subnet resources sooner while leaving guaranteed-response calls unchanged.

Changes:

  • Applies caller deadlines to consensus timeout construction and validation.
  • Caps client adapter timeouts using bounded-wait deadlines and distinguishes deadline expiry from insufficient cycles.
  • Adds deadline and queue-recovery tests, plus their dependencies.
File Description
rs/​https_outcalls/​consensus/​src/​payload_builder/​tests.rs Tests bounded-wait timeout boundaries, including flexible requests.
rs/​https_outcalls/​consensus/​src/​payload_builder.rs Centralizes protocol and caller-deadline timeout checks.
rs/​https_outcalls/​client/​src/​client.rs Adds adapter deadline limits, expiry handling, and tests.
rs/​execution_environment/​tests/​execution_test.rs Tests callback expiry, refunds, and queue recovery.
rs/​execution_environment/​Cargo.toml Adds the registry test dependency.
rs/​execution_environment/​BUILD.bazel Adds registry dependencies for execution tests.
Cargo.lock Records the added test dependency.

Review effort: Balanced

Comment thread rs/https_outcalls/client/src/client.rs Resolved
The client counted a bounded-wait outcall's time from the request's creation,
so a request the pool manager dispatched late, e.g. after a full client queue,
still got its full budget and could start after its deadline. Move the timeout
rule to `CanisterHttpRequestContext::timeout_time()`, carry the time of the
dispatching state in `CanisterHttpRequest`, and budget from there. Also hold
the test subnet weakly to avoid a reference cycle.

Co-Authored-By: Claude Opus 5.5 <[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.

🔵 Needs a closer look

Consensus-visible timeout and charging behavior needs human validation supported by passing consensus and end-to-end tests, which were not executed during this review.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

valorjesson-commits pushed a commit to Marketearth/ic that referenced this pull request Nov 3, 2026
…#12001)

Adds a `class` label (`guaranteed response` or `best-effort`) to
`execution_http_outcalls_delivered_total`, so that we can see how many
HTTP outcalls are made with bounded-wait calls. That is useful for
dfinity#11932, which cancels bounded-wait outcalls at their deadline.

The class is read from the request in the outcall's context, using the
label name and values that the other execution and message-routing
metrics already use for the call class. Outcalls that time out are
delivered through the same path, so the counter still covers every
outcall.

For dashboards: the counter now has two series per (pricing version,
replication kind) pair. Queries that aggregate over it are unaffected;
ones that select a single series need a `sum`.

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

Co-authored-by: Claude Opus 5.5 <[email protected]>
Call the time at which an outcall times out its effective deadline, and the
client's budget until then the time left.

Co-Authored-By: Claude Opus 5.5 <[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.

🟢 Approval recommended

No active review issues block approval of the HTTP outcall deadline changes.

No open issues 🎉

Review effort: Balanced

Resolve import conflicts in canister_http.rs and execution_test.rs.

Co-Authored-By: Claude Opus 5.5 <[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.

🟢 Approval recommended

No active review issues are reported for the changes aligning HTTP outcall expiration with caller deadlines.

No open issues 🎉

Review effort: Balanced

@eichhorl eichhorl added the CI_ALL_BAZEL_TARGETS Runs all bazel targets label Nov 12, 2026
…heir deadline

Extends canister_http_time_out_test with a bounded-wait outcall (5s timeout) to an
endpoint that answers after 40s, and checks that consensus delivers a timeout for it.
Without the cancellation, the adapter's 30s request timeout ends the outcall with a
response before consensus's own 60s timeout, so no timeout is delivered.

Adds a send_bounded_wait_request method to the proxy canister.

Co-Authored-By: Claude Opus 5.5 <[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.

🟢 Approval recommended

No active review issues were identified for the bounded-wait HTTP deadline changes.

No open issues 🎉

Review effort: Balanced

@eichhorl
eichhorl requested a balanced review from Copilot November 12, 2026 10:31
@eichhorl eichhorl removed the CI_ALL_BAZEL_TARGETS Runs all bazel targets label Nov 12, 2026

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.

🔵 Needs a closer look

The change affects consensus timeout validity, requiring human review of mixed-version rollout compatibility and replica/adapter cancellation and deadline behavior that could not be validated in this environment.

No open issues 🎉

Review effort: Balanced

…ange

The new send_bounded_wait_request method changes the proxy canister's wasm, which
flips the split-finder's partition back to the 12/8 one, as in #11774.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@eichhorl
eichhorl requested a balanced review from Copilot November 12, 2026 10:37
@eichhorl
eichhorl marked this pull request as ready for review November 12, 2026 10:38
@eichhorl
eichhorl requested a review from a team as a code owner November 12, 2026 10:38
@zeropath-ai

zeropath-ai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

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

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► rs/execution_environment/BUILD.bazel
    Include registry proto data provider and routing table in test suite dependencies
► rs/execution_environment/Cargo.toml
    Add ic-registry-proto-data-provider
Enhancement ► rs/execution_environment/tests/execution_test.rs
    Update imports and add ProtoRegistryDataProvider and routing table usage
► rs/execution_environment/tests/execution_test.rs
     Introduce application_subnet_with_payload_builder and related test setup
► rs/execution_environment/Cargo.toml
    Add ic-registry-proto-data-provider
Enhancement ► rs/https_outcalls/client/src/client.rs
    Pass and utilize time_left for bounded-wait/timeouts in HTTP request execution
Enhancement ► rs/https_outcalls/consensus/src/payload_builder.rs
    Use effective_deadline for timeout checks; adjust timeout logic to account for bounded-wait deadlines
► rs/https_outcalls/consensus/src/payload_builder/tests.rs
    Adapt tests to new effective_deadline behavior and bounded-wait scenarios
Enhancement ► rs/https_outcalls/consensus/src/pool_manager.rs
    Record dispatch_time in requests; add test for dispatch_time preservation
Enhancement ► rs/pocket_ic_server/src/pocket_ic.rs
    Capture dispatch_time from latest state for Canister HTTP requests and responses
Enhancement ► rs/recovery/subnet_splitting/tests/integration_tests.rs
    Update expected metrics values reflecting changes from registry/routing updates
Enhancement ► rs/rust_canisters/proxy_canister/src/main.rs
    Add send_bounded_wait_request update method to perform bounded-wait HTTP calls via management canister
Enhancement ► rs/tests/networking/canister_http_time_out_test.rs
    Extend test plan to cover bounded-wait HTTP request timeouts and related metrics

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.

🔵 Needs a closer look

Human assessment is needed because deadline-boundary behavior can override successful supplied mocks and misclassify equal-limit timeouts as insufficient cycles.

No open issues 🎉

Review effort: Balanced

Comment thread rs/types/types/src/canister_http.rs Resolved
…dline

Callbacks expire, to the second, at the start of a round, while the timeout's
reject only reaches the caller through the loopback stream a round later. At
mainnet's 2-3 blocks/s, the caller therefore usually got SYS_TRANSIENT "Canister
http request timed out" rather than SYS_UNKNOWN. Timing out a second past the
deadline means the callback has always expired by then, so the caller gets
SYS_UNKNOWN, as for any other bounded-wait call that runs out.

The StateMachine test now runs rounds 300ms apart; it fails without the extra
second.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 13, 2026 07:41

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.

🟢 Approval recommended

No active review issues were identified for the bounded-wait HTTP outcall cancellation changes.

No open issues 🎉

Review effort: Balanced

@eichhorl
eichhorl enabled auto-merge November 13, 2026 08:25
@eichhorl
eichhorl added this pull request to the merge queue Nov 13, 2026
Merged via the queue into master with commit 54378f9 Nov 13, 2026
43 checks passed
@eichhorl
eichhorl deleted the eichhorl/outcall-deadline-cancellation branch November 13, 2026 08:48
AleDema pushed a commit to AleDema/ic that referenced this pull request Nov 18, 2026
Upgrade the rust toolchain from 1.99.1 to 1.100.0. See:
https://blog.rust-lang.org/2026/11/12/Rust-1.100.0/.

The `cargo clippy` fixes this needs are in the PR below this one in the
stack (dfinity#12142). This PR
is therefore the version bump in `rust-toolchain.toml` and
`bazel/rust.MODULE.bazel`, plus:

* checksums for the 1.100.0 archives our builds download, which
rules_rust 0.75.0 doesn't have,
* the removal of the `clippy::double_must_use` allow, which 1.100.0 no
longer needs,
* an off-by-one fix in the `subnet_splitting` integration test that
1.100.0's codegen exposes,
* the test data that the new codegen shifts.

## Canbench

Five of the eight canbench suites moved beyond their noise thresholds,
all towards *fewer*
instructions. Heap and stable-memory increases are unchanged everywhere,
and only `instructions`
lines changed in the results files.

| suite | totals beyond the noise threshold | change of all totals |
results file |
| --- | --- | --- | --- |
| ckBTC minter | 0 of 7 (but 7 scopes) | -0.26% to -0.74% | regenerated
|
| ckETH minter | 1 of 1 | -5.20% | regenerated |
| ICRC-1 ledger (u64) | 1 of 2 (and 5 of its scopes) | -0.22% to -3.76%
| regenerated |
| ICRC-1 ledger (u256) | 1 of 2 (and 5 of its scopes) | -0.22% to -3.73%
| regenerated |
| registry | 2 of 14 | +0.10% to -5.34% | regenerated |
| ICP ledger | 0 of 1 | -0.55% | unchanged |
| NNS governance | 0 of 28 (5% threshold) | +1.67% to -2.11% | unchanged
|
| SNS governance | 0 of 1 | +0.01% | unchanged |

**`//rs/bitcoin/ckbtc/minter:ckbtc_minter_canbench_test`** was
regenerated with
`bazel run //rs/bitcoin/ckbtc/minter:ckbtc_minter_canbench_update`. All
7 benchmark totals stay
within the noise threshold (-0.26% to -0.74%), but 7 small `::greedy`
scopes moved beyond it. They
more than undo the +9% to +11% that 1.99.0 added to the same scopes
(dfinity#11735):

| status | name | calls | ins | ins Δ% | HI | HI Δ% | SMI | SMI Δ% |

|--------|----------------------------------------------------|-------|--------|---------|----|--------|-----|---------|
| - | `build_unsigned_transaction_2_100k_sats::greedy` | 1 | 4.15K |
-13.35% | 0 | 0.00% | 0 | 0.00% |
| - | `build_estimate_retrieve_btc_fee_1_50k_sats::greedy` | 1 | 4.10K |
-13.48% | 0 | 0.00% | 0 | 0.00% |
| - | `build_unsigned_transaction_1_50k_sats::greedy` | 1 | 4.10K |
-13.48% | 0 | 0.00% | 0 | 0.00% |
| - | `build_unsigned_transaction_6_10_btc::greedy` | 1 | 11.50K |
-14.29% | 0 | 0.00% | 0 | 0.00% |
| - | `build_unsigned_transaction_4_10m_sats::greedy` | 1 | 3.81K |
-14.38% | 0 | 0.00% | 0 | 0.00% |
| - | `build_unsigned_transaction_5_1_btc::greedy` | 1 | 3.81K | -14.38%
| 0 | 0.00% | 0 | 0.00% |
| - | `build_unsigned_transaction_3_1m_sats::greedy` | 1 | 2.62K |
-20.09% | 0 | 0.00% | 0 | 0.00% |

**`//rs/ethereum/cketh/minter:cketh_minter_canbench_test`** was
regenerated with
`bazel run //rs/ethereum/cketh/minter:cketh_minter_canbench_update`. Its
only benchmark moved beyond
the noise threshold:

| status | name | calls | ins | ins Δ% | HI | HI Δ% | SMI | SMI Δ% |

|--------|--------------------|-------|-------|---------|-----|--------|-----|---------|
| - | `bench_post_upgrade` | | 1.14B | -5.20% | 290 | 0.00% | 0 | 0.00%
|

**`//rs/ledger_suite/icrc1/ledger:canbench_u64_test`** and
**`:canbench_u256_test`** were
regenerated with `bazel run
//rs/ledger_suite/icrc1/ledger:canbench_u64_update` and
`:canbench_u256_update`. Both moved the same way. u64:

| status | name | calls | ins | ins Δ% | HI | HI Δ% | SMI | SMI Δ% |

|--------|-----------------------------------------------|-------|---------|---------|-----|--------|-----|---------|
| - | `bench_icrc1_transfers` | | 48.23B | -3.76% | 264 | 0.00% | 256 |
0.00% |
| - | `bench_icrc1_transfers::icrc2_transfer_from` | 1 | 18.87B | -4.76%
| 3 | 0.00% | 0 | 0.00% |
| - | `bench_icrc1_transfers::upgrade` | 1 | 473.43M | -4.91% | 202 |
0.00% | 128 | 0.00% |
| - | `bench_icrc1_transfers::icrc2_approve` | 1 | 16.78B | -5.65% | 28
| 0.00% | 128 | 0.00% |
| - | `bench_icrc1_transfers::post_upgrade` | 1 | 323.70M | -6.73% | 73
| 0.00% | 0 | 0.00% |
| - | `bench_icrc1_transfers::icrc103_get_allowances` | 1 | 3.94M |
-26.26% | 0 | 0.00% | 0 | 0.00% |

u256:

| status | name | calls | ins | ins Δ% | HI | HI Δ% | SMI | SMI Δ% |

|--------|-----------------------------------------------|-------|---------|---------|-----|--------|-----|---------|
| - | `bench_icrc1_transfers` | | 49.77B | -3.73% | 262 | 0.00% | 256 |
0.00% |
| - | `bench_icrc1_transfers::icrc2_transfer_from` | 1 | 19.32B | -4.72%
| 3 | 0.00% | 0 | 0.00% |
| - | `bench_icrc1_transfers::upgrade` | 1 | 468.90M | -4.75% | 200 |
0.00% | 128 | 0.00% |
| - | `bench_icrc1_transfers::icrc2_approve` | 1 | 17.32B | -5.58% | 28
| 0.00% | 128 | 0.00% |
| - | `bench_icrc1_transfers::post_upgrade` | 1 | 318.12M | -6.85% | 71
| 0.00% | 0 | 0.00% |
| - | `bench_icrc1_transfers::icrc103_get_allowances` | 1 | 4.84M |
-22.50% | 0 | 0.00% | 0 | 0.00% |

**`//rs/registry/canister:registry-canbench_test`** was regenerated with
`bazel run //rs/registry/canister:registry-canbench_update`. Two of its
14 benchmarks moved beyond
the noise threshold:

| status | name | calls | ins | ins Δ% | HI | HI Δ% | SMI | SMI Δ% |

|--------|-------------------------------------------------------------|-------|---------|---------|-----|--------|-----|---------|
| - | `get_subnet_for_canister_100_times_100` | | 27.17M | -3.28% | 0 |
0.00% | 0 | 0.00% |
| - | `measure_routing_table_invariant_checks_shards_and_unsharded` | |
211.57M | -5.34% | 138 | 0.00% | 0 | 0.00% |

The other three suites (ICP ledger, NNS governance, SNS governance) stay
within their noise
thresholds, so their results files are unchanged.

## `subnet_splitting`

**`//rs/recovery/subnet_splitting:integration_test`** has no `_update`
target, and it needed two
commits:

1. **A bound fix.** On 1.100.0 the split-finder's optimal split uses all
10 allowed cuts, and puts
both the first and the last canister on the side it reports, so it
reports 6 ranges. The test
allowed only `MAX_CUTS.div_ceil(2)` = 5. But 10 cuts make up to 11
segments that alternate
between the two subnets, so one side can get 6 of them. The test now
allows `MAX_CUTS / 2 + 1`,
and its failure message gives that bound and the ranges (it used to say
"at most 10").
2. **A re-pin.** All ten expected values were re-pinned by hand from one
1.100.0 reference run, in
   that run's source/destination orientation.

As with 1.99.0 (dfinity#11735), what changed is the *partition*, not the
workload:

* Every total is identical: canisters 20, ingress messages 39, remote
10, local 28, http outcalls
10, heartbeats 694. Total instructions moved by 0.004% and total state
size by 0.23%.
* Both partitions balance instructions ~50/50, which the test also
checks.

Source / destination as each run reports them (which group is which is
arbitrary):

| metric | 1.99.1 | 1.100.0 |
| --- | --- | --- |
| `states_sizes_bytes` | 3712908 / 5569325 | 5044173 / 4259662 |
| `instructions_executed` | 144307301 / 145741551 | 145713211 /
144348562 |
| `canisters_installed` | 8 / 12 | 11 / 9 |
| `ingress_messages_executed` | 15 / 24 | 21 / 18 |
| `remote_subnet_messages_executed_lower_bound` | 4 / 6 | 5 / 5 |
| `local_subnet_messages_executed_upper_bound` | 11 / 17 | 15 / 13 |
| `http_outcalls_executed` | 4 / 6 | 6 / 4 |
| `heartbeats_and_global_timers_executed` | 368 / 326 | 341 / 353 |

The test is deterministic: 3/3 uncached runs on 1.100.0 give identical
estimates. But it pins the
exact solution of a degenerate optimisation, and it has now been
re-pinned six times since
September, mostly for unrelated changes (dfinity#11171, dfinity#11534, dfinity#11735, dfinity#11774,
dfinity#12043, dfinity#11932). Asserting
on the totals and on the ~50/50 instruction balance would make it
robust.

## Clippy allows

`ci/scripts/rust-lint.sh` and the PocketIC Windows lint
(`.github/workflows/pocket-ic-tests-windows.yml`)
no longer pass `--allow clippy::double_must_use`, and `rust-lint.sh`
drops the comment that explained
both allows. Clippy 0.1.100 ships the fix for the
`#[async_trait]` false positive
([rust-lang/rust-clippy#17547](rust-lang/rust-clippy#17547)),
and without the allow the lint reports nothing in the workspace.
`redundant_field_names` stays
allowed: 0.1.100 still flags the same 41 sites in thiserror and
derive-new output, and the fix

([rust-lang/rust#164816](rust-lang/rust#164816))
ships in 1.101.

## Toolchain checksums and repin

rules_rust 0.75.0 (released 2026-10-26, still the latest) ships
checksums for 1.99.1 but not for
1.100.0, and it downloads an archive unverified when it has no checksum
for it. So `rust.toolchain`
now passes `sha256s` for the 21 archives of 1.100.0 that builds on our
supported hosts
(`aarch64-apple-darwin`, `aarch64-unknown-linux-gnu` and
`x86_64-unknown-linux-gnu`) download between
them:

* `rustc`, `cargo`, `clippy`, `llvm-tools` and `rust-analyzer` for each
of the three hosts
* `rust-std` for the three hosts and for the targets they cross-compile
to: `wasm32-unknown-unknown`,
and `x86_64-apple-darwin`, which the darwin CI job builds
`pocket-ic-server` for
  (`--platforms=//:macos-intel`)
* `rust-src`

rules_rust also registers toolchains for 8 other hosts and for the
`wasm32-wasip1` and
`wasm32-wasip2` targets. But Bazel only downloads a toolchain when a
build selects it, and our builds
never select those. Neither does CI's target selection: its
`rdeps(//..., …)` queries load the
closure of `bazel query 'deps(//...)'`, which contains none of the Rust
toolchain repositories. A build on another host, or for a new target,
would
download those archives unverified, so the comment above the dict says
what to add when supporting
one. An exception on a supported host: building `//:rustfmt` (alone or
as part of `//...`) with
`--platforms=//:macos-intel` also fetches the `x86_64-apple-darwin`
tools unverified, because
rules_rust's rustfmt rule makes the target platform an execution
platform. Nothing in the repo or
CI does that.

The checksums are the `xz_hash`es from the GPG-signed
`channel-rust-1.100.0.toml`. They match the
`.sha256` files at the exact URLs rules_rust downloads from, and the
archives themselves, each of
which has a valid signature. The dict can go once a rules_rust release
ships these checksums.

A key that doesn't match what rules_rust looks up is silently ignored,
so the keys were checked
against Bazel too:

* Force-fetching the 8 toolchain repositories those builds use, through
an empty repository cache,
downloads and verifies 19 of the 21 archives on x86_64 Linux. The other
2 are `rust-analyzer` for
the two arm64 hosts, which only those hosts fetch. None of them triggers
the "canonical
reproducible form" DEBUG message that Bazel prints when a rules_rust
toolchain repository
downloads an archive it has no checksum for. As a control, the
`wasm32-wasip2` repository, which
our builds don't use, does: the `sha256s` it suggests adds its
`rust-std`, which isn't in the dict.
* Corrupting a single checksum makes the fetch fail with `Checksum was …
but wanted …`. Tried for
`rust-std` for `x86_64-apple-darwin` and `wasm32-unknown-unknown`,
`rustc` for
`aarch64-unknown-linux-gnu`, `llvm-tools` for `aarch64-apple-darwin`,
and `rust-analyzer` for
  `x86_64-unknown-linux-gnu`.
* On x86_64 Linux, `bazel build //... --nobuild` fetches no Rust
toolchain archive without a
  checksum.

No repin is needed. The `Cargo.Bazel.*.lock` digests hash the
`cargo`/`rustc` of rules_rust's own
host tools (1.99.1 in rules_rust 0.75.0), not the version selected by
`rust.toolchain`, and no
third-party crate changed. Bazel accepts the existing lock files.

## Also checked, since tests won't necessarily catch these

* **Never type**
([rust#155499](rust-lang/rust#155499)): `!` is
stable,
`Infallible` is now an alias for it, and the never-type fallback is `!`
on all editions. Only 5
crates are not on edition 2024 under Cargo (`rate_limits` and four
`guest_upgrade` crates; Bazel
already builds them as 2024), and they compile cleanly. The only `impl
From<Infallible>`
  (`ic-protobuf`'s `ProxyDecodeError`) compiles too.
* **`Iterator::{min,max}(_by_key)`**
([rust#160203](rust-lang/rust#160203))
now call `Ord::{min,max}` and `PartialOrd::{lt,le,gt,ge}`, so they can
only behave differently
for types that override those inconsistently with `cmp`. No first-party
type overrides them.
* **Wasm and LLVM**: the `wasm32-unknown-unknown` target spec is
identical on both toolchains, and
LLVM stays on 23 (23.1.1 → 23.1.5), so the LLVM-bitcode caveat from
dfinity#11735 is unchanged.
* **Cargo's build-directory layout** changed. The only code that parses
build paths,
`canister_sandbox`'s profile detection, matches `/target/<profile>/` and
still does. Bazel is
  unaffected.
* **Cargo's new `[lints.cargo]`**: the warn-by-default
`unused_dependencies` lint now reports 30
dependencies in 24 manifests during `cargo clippy --workspace
--all-targets`, plus an unused
workspace dependency (`ring`) and a redundant `homepage`
(`ic-management-canister-types`). These
are warnings, so CI doesn't fail on them. Some are false positives: the
lint only sees the host
target, so dependencies used only on `wasm32`, like
`ic-dummy-getrandom-for-wasm`, look unused.
  This PR leaves them to their owners.
* **rustfmt**: stable 1.11.0 accepts the tree unchanged.

## Testing

* `./ci/scripts/rust-lint.sh` exits 0 on 1.100.0.
* All 8 canbench tests and the `subnet_splitting` integration test pass.
* `bazel build` of all 2,091 Rust targets, including the 110 wasm
canisters, succeeds on 1.100.0.
That covers the `wasm32`-only code and Bazel-only crates that `cargo
clippy` doesn't see.
* `bazel build //... --nobuild` analyzes all 3,387 targets, and
buildifier is clean.
* After merging dfinity#12142's review changes, on 1.100.0: `rust-lint.sh`,
`cargo check` of
`ic-sns-governance` and `ic-admin`, and `bazel build` of the 6 directly
affected targets pass, and
so do 60 of the 61 non-system tests within two hops of the changed
files. The other one,
`golden_state_swap_upgrade_twice`, can't fetch its golden state over SSH
from the dev environment.
* CI with `CI_ALL_BAZEL_TARGETS` passed on 5546a65. The commits since
(the checksums, the
`rust-lint.sh` comment and the merged dfinity#12142 review changes) get the
default diff-based CI.

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
AleDema pushed a commit to AleDema/ic that referenced this pull request Nov 18, 2026
…ne (dfinity#12121)

Follow-up to dfinity#11932, which made the HTTPS outcalls client stop waiting
for the adapter at an outcall's effective deadline. The transform that
follows is still awaited without a deadline. A transform that hasn't run
by the deadline is wasted work: consensus has already timed the outcall
out and drops its result.

This PR applies the same deadline to the transform:

- At the outcall's effective deadline, measured from dispatch like the
adapter call, the client gives up on a transform that hasn't started and
reports the same `SYS_TRANSIENT` "Deadline Exceeded" reject. The query
handler then skips it.
- A transform that has started by the deadline is still waited for and
charged as before. The query handler and the client decide once, through
`TransformStart` in `TransformExecutionInput`, which of the two happens,
so a transform can't start after the client has given up on it.

Behavior changes:

- A transform that hasn't started by its outcall's deadline no longer
runs.
- In PocketIC, mocked outcalls go through the same client, so the
transform of a mocked response now has to start within the time the
outcall has left.

Tests (client):

- `test_client_stops_waiting_for_transform_at_request_deadline`: a
transform that never starts is given up on at the deadline with the
deadline reject, and the query handler would skip it. On master the
client keeps waiting.
- `test_client_waits_for_transform_started_by_request_deadline`: a
transform that starts before the deadline but finishes after it is
waited for, and charged under pay-as-you-go pricing.

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
q-uint pushed a commit to Swiss-Subnet/ic that referenced this pull request Nov 19, 2026
…ompatible versions (dfinity#12177)

Refreshes both lock sets (`Cargo.lock` and
`Cargo.Bazel.{toml,json}.lock`) to the newest semver-compatible
versions, and fixes the Cargo/Bazel drift that had built up between
them.
- Bazel (what CI tests and what we ship) moves 541 locked versions, and
Cargo 363.
- Before this PR, 362 crates.io packages that both locks contain were
locked at different versions. Now 31 are, each one explained
[below](#remaining-cargo-vs-bazel-differences).

This is the first of a series of dependency-upgrade PRs.
- The updates most likely to change canister or replica behaviour are
held back here and follow in small owner-reviewed PRs: canister runtime
(candid, ic-cdk, num-bigint, serde_json, time, …) and replica runtime
(wasmtime 48.0.9, flate2, the TLS stack). Smaller behaviour changes do
land; they are listed under [Behaviour changes](#behaviour-changes-fyi).
- Major-version bumps follow separately.

No `BUILD.bazel` changes. The only `.rs` changes are [test
fixes](#test-fixes).

# Changes

## Lift the syn 3 ban

dfinity#11016 banned syn 3 as a stopgap ("we'll update everything to v3
later"). The latest releases of 27 crates in our graph now require it:
21 proc-macros (serde_derive, tokio-macros, clap_derive, async-trait, …)
and 6 macro-support or code-generation libraries (darling_core,
pest_generator, prettyplease, prost-build, synstructure,
wasm-bindgen-macro-support). Keeping the ban would hold them at their
last syn-2 releases, and with them clap (4.6.3), serde (1.0.228) and
futures (0.3.33), which require their macro crates at exact versions.
- `thiserror = "=2.0.18"` → `2.0.21`, in both `Cargo.toml` and
`bazel/rust.MODULE.bazel`.
- The `enum-ordinalize-derive = "=4.4.1"` constraint spec and the "DO
NOT upgrade" comments are deleted.
- syn 3 now coexists with syn 2. The repo's own proc-macros stay on syn
2.
- The tarpc fork stays for now. Its comment gives syn 3 as the reason,
but the published tarpc that uses syn 3, 0.38.0, is a
semver-incompatible bump and follows with the major-version PRs.

The published `pocket-ic` 16.x inherited the exact `=2.0.18` pin, so a
new `pocket-ic` release unblocks downstream users.

## Refresh

`cargo update` and `./bin/bazel-pin.sh --full`.
- This also clears 4 yanked locked versions: chacha20 0.10.0 (SIGILL on
x86 without SSE4.1) and spin 0.9.8 in both locks, plus iana-time-zone
0.1.59 and rgb 0.8.37 in Bazel.
- `cc` is constrained to `~1.2`, both in the Bazel spec (was `=1.2.48`)
and in `rs/canister_sandbox`, so it stays on the 1.2 line. The `=1.2.48`
pin existed only for `bazel/cc_rs.patch`, which dfinity#10991 deleted. cc 1.11
changes default C flags (e.g. `-march=x86-64` for GCC) and how C++ code
links, so it will be its own PR.

## Held back

Except where noted, each lock keeps the version it had before this PR.
These move in follow-up PRs reviewed by their owners:
- **Execution / crypto / networking:**
- wasmtime/pulley 48.0.7 (cranelift 0.135.7) and wirm 4.0.4. This
includes cranelift's internal crates (`cranelift-assembler-x64`,
`-assembler-x64-meta`, `-codegen-shared`, `-control`, `-srcgen`) and
regalloc2, which cranelift requires with caret ranges.
  - flate2.
- The TLS stack: aws-lc-rs/aws-lc-sys, rustls-pki-types, rustls-webpki,
webpki-roots and webpki-root-certs, tokio-rustls, hyper-rustls,
rustls-native-certs/openssl-probe, async-web-client, and brotli
8/brotli-decompressor 5, which rustls uses to compress certificates in
node-to-node TLS. For example, rustls-pki-types 1.16 strips a trailing
dot from server names, and webpki-root-certs 1.0.12 would change
ic-gateway's trust roots.
- **Canister runtime:**
  - candid, ic-cdk/ic0, num-bigint, rust_decimal, serde_json.
- serde_with stops at 3.22.0, up from 3.21.0. It is the newest release
that works with the held serde_json, and its changes touch only adapters
we don't use.
  - time, walrus (ic-wasm's copy), ic-stable-structures (Bazel).
- The rust-bitcoin `.101` family, secp256k1 0.29 and secp256k1-sys 0.10.
- **Breaks the build:** systemstat stops at 0.2.7, which both locks now
use. 0.2.8 adds a `RefCell` to the Linux `PlatformImpl`, so it is no
longer `Sync`, and ic-bn-lib's `GetsSystemInfo: Send + Sync` bound fails
to compile.
- **Bazel only:**
- assert_cmd 2.0.16. From 2.2, `cargo_bin` panics instead of returning
`Err`, which breaks `fstrim_tool_integration` under Bazel.
- ssh2/libssh2-sys, whose new version bumps the libssh2 C library and
needs `bazel/libssh2-sys.patch` removed.
- libfuzzer-sys 0.4.7. From 0.4.8, `test_input_wrap` is an `unsafe fn`,
which no longer fits the `fn` callback type that
`//rs/execution_environment/fuzz:fuzzer_sandbox` passes to
`LLVMFuzzerRunDriver`.
- ping 0.5.0. From 0.5.1, `dgramsock::ping` waits for a reply that
carries its request's ICMP echo identifier, but Linux ping sockets
replace that identifier, so every ping times out. SetupOS/HostOS uplink
detection then finds no interface, HostOS creates no `br6` bridge, and
the GuestOS VM never starts. This failed the 8 `//rs/tests/nested` tests
that boot a HostOS built from this branch.

## Annotation and patch updates

- The wasm32 getrandom override annotation hard-coded the repo names
`crate_index__getrandom-0.2.10`, `crate_index__cfg-if-1.0.0` and
`crate_index__libc-0.2.186`, which the refresh replaces.
  - cfg-if and libc now use the version-independent hub labels.
  - getrandom is updated to 0.2.17.
- `bazel/pkg-config.patch` is rebased onto pkg-config 0.3.34, whose new
`probe_cflags` field changed the hunk's last context line. Bazel's
patcher would still apply the old hunk with fuzz; the rebased one
applies exactly.

## Cargo/Bazel sync

- Aligned requirements: axum-server, humantime 2.4 (the locks differed),
ic-cbor, ic-certification, ic_principal, indexmap, nftables,
parking_lot, procfs, scopeguard, tar and walkdir.
- Cargo floors raised to Bazel's: time 0.3.47 (RUSTSEC-2026-0009),
tracing-subscriber 0.3.20 (RUSTSEC-2025-0055), rsa 0.9.10.
- dashmap: the Bazel spec was `^5.3.4`, so Bazel built ic-boundary
against dashmap 5 while Cargo used 6. It is now 6.2.1 in both.
- insta becomes a workspace dependency at 1.49.
- ic-canister-sig-creation: Bazel used a git rev, Cargo crates.io 1.3.1.
Both now use crates.io 1.3.1; the source is identical.
- Feature sets:
- rustix: `stdio`/`termios` in both, plus `fs` in Bazel (Cargo already
had it). infogetty uses all three, but they were only enabled
transitively: `stdio`/`termios` by crossterm, and Bazel's `fs` by
tempfile, memfd and xattr.
  - libcryptsetup-rs `mutex` is added in Cargo.
  - backon `std-blocking-sleep`, unused, is dropped in Bazel.
- `chrono_canisters` moves to tag v0.4.44. It must differ from registry
chrono's version, because cargo-bazel keys crates by name and version.

## Unreferenced `crate.spec`s deleted

addr, bindgen, chacha20poly1305, cidr, console, enum-ordinalize-derive,
ff, form_urlencoded, ic-cdk-executor, pkg-config (its patch annotation
stays), rustversion, tabled, toml, tracing-slog.

No BUILD file or manifest references them. Some pinned dead old versions
into the Bazel graph.

## `bin/bazel-pin.sh`

- New `--full` flag, optionally followed by crates to pin afterwards.
The no-argument default is a minimal `cargo update --workspace`, which
cannot refresh transitive crates.
- Several crates are now repinned one at a time. Before, rules_rust read
them as one invalid package spec.
- The help text said `[email protected]` for a precise pin, which is wrong;
it now shows `serde=1.0.130` and `[email protected]=1.0.130`. Its dead link
to the rules_rust docs now points at the code that parses
`CARGO_BAZEL_REPIN`.

## Test fixes

- **Snapshot heap-delta rate-limit tests** (`rs/execution_environment`).
`take_canister_snapshot_fails_when_heap_delta_rate_limited` and
`load_canister_snapshot_fails_when_heap_delta_rate_limited` set their
heap-delta rate limits (80,000 and 150,000 bytes) just below the heap
delta of one and two snapshots of the universal canister (86,016 bytes
each).
  - That heap delta is mostly the canister's data-segment pages.
- The refresh builds the universal canister with pretty 0.12.5 (a candid
dependency), which uses unicode-width's tables instead of
unicode-segmentation's. Its data segments shrink by 4 pages, to 69,632
bytes per snapshot, so neither test reached its limit anymore. The
replica's behaviour is unchanged.
- The tests now write 1 MiB of stable memory before taking the snapshot
and set the limits relative to it, so they no longer depend on the
canister's size.
- **`subnet_splitting` integration test** (`rs/recovery`). The rebuilt
universal and proxy canisters execute slightly different instruction
counts, so the split-finder picks a different, equally balanced split
with the same totals. The expected per-subnet values are updated, as
dfinity#11932 and dfinity#12143 did.
- **NNS governance canbench**, regenerated with `bazel run
//rs/nns/governance:governance-canbench_update`. Two of the 28
benchmarks moved beyond the noise threshold:
`neuron_metrics_calculation` +8.67% (3.65M instructions) and
`draw_maturity_from_neurons_fund` -6.67% (7.12M). Only instruction
counts changed; heap and stable-memory increases are the same.
@dfinity/governance-team

## Remaining Cargo-vs-Bazel differences

Among crates.io packages that both locks contain:
- **Held back (19):**
- assert_cmd, libfuzzer-sys, ping and ssh2/libssh2-sys are held in Bazel
only, while Cargo has their newest releases (2.2.2, 0.4.13, 0.5.2 and
0.9.7/0.3.4).
- bitcoin-io, bitcoin_hashes, brotli, flate2, ic-stable-structures,
openssl-probe, rustls-native-certs, rustls-pki-types, secp256k1,
secp256k1-sys, serde_json, tokio-rustls, webpki-root-certs and
webpki-roots keep each lock's version from before this PR.
- **Extra versions that only Bazel targets use (12):**
- ssh2 0.9.4 pulls in parking_lot 0.11, parking_lot_core 0.8,
redox_syscall 0.2 and bitflags 1.
- ic-wasm's `check-endpoints` feature, enabled only in Bazel, pulls in
candid_parser 0.4.1 and logos 0.14 (+ `-codegen`, `-derive`). Through
toml 0.8 it also brings toml_edit 0.22, toml_datetime 0.6 and winnow
0.7.
  - little-loadshedder pulls in tower 0.4.

16 more packages are in only one lock:
- Bazel only:
- from ic-wasm's `check-endpoints`: handlebars, derive_builder (+
`_core`, `_macro`), num-order, num-modular, toml and serde_spanned (all
via candid_parser 0.4.1), and parse-display (+ `-derive`);
- from the Bazel-only holds: instant (parking_lot 0.11) and doc-comment
(assert_cmd 2.0.16);
- declared only in BUILD files: little-loadshedder, quickcheck and
syscalls.
- Cargo only: zmij (serde_json 1.0.149).

Bazel also locks chrono 0.4.44 from git, for `chrono_canisters`.

# Behaviour changes (FYI)

- **zstd:** libzstd 1.5.6 → 1.5.7 (zstd-sys 2.1.3). This affects replica
state-sync chunk compression (wire-compatible) and the orchestrator's
subnet-recovery `tar.zst` downloads. @dfinity/core-protocol
- **hyper:** hyper 1.12 / hyper-util 0.1.21 parse HTTP/1 more strictly,
and tasks they spawn no longer inherit the caller's tracing span.
- **tonic:** tonic 0.14.9 changes some status-code mappings, which may
show in adapter error metrics.
- **ic-agent:** 0.49.3 retries HTTP 503.
- **actix-web:** 4.20, used by ICP Rosetta, now requires a Host header
and turns TCP_NODELAY on. @dfinity/defi
- **Bazel catch-ups:** Bazel was further behind than Cargo, so some of
its jumps are larger than the `Cargo.lock` diff shows: clap 4.5 → 4.6,
slog 2.7 → 2.8, insta 1.31 → 1.49, actix-web 4.9 → 4.20, bytemuck 1.13 →
1.25 and url/idna_adapter (ICU4X 1 → 2). CI tests the Bazel build (the
Cargo gate only compiles), so for most of the 541 new Bazel versions
this PR's CI is their first test run.

## Mixed versions and reproducibility

- **State sync between replica versions** is unaffected by libzstd
1.5.7. In the replica, zstd only compresses state-sync chunks for the
wire (`rs/p2p/state_sync_manager/src/routes/chunk.rs`), and the receiver
checks the chunk, sub-manifest and root hashes on the decompressed
bytes. 1.5.7 writes different bytes for about two thirds of chunk-shaped
payloads, but the frame format is unchanged: in a cross-version test of
the two vendored libraries, every frame decoded on the other version to
the exact input (1,340 decodes). prost 0.14.6 doesn't change how the
state-sync, transport and manifest messages are encoded, and quinn,
rustls, tokio and axum don't move.
- **Reward computations stay reproducible.** The node rewards
calculation, NNS and SNS voting rewards, maturity modulation and the
CMC's ICP/XDR averages compute with rust_decimal, rust_decimal_macros,
num-traits, libm, integer arithmetic and `f64`, and read their state
through ic-stable-structures and candid. None of these changes version
or enabled features in either lock. Of the crates on those paths that do
move, chrono (v0.4.41 → v0.4.44, `chrono_canisters`), itertools 0.12.1
and prost-derive 0.14.6 change nothing the reward code calls for valid
input, and crc32fast 1.5.5 (principal and account-identifier checksums)
restructures its wasm32 path but computes the same CRC-32.

# Verification

Run locally in the dev container, on this branch:
- `cargo update --workspace` reports "Locking 0 packages",
`./bin/bazel-pin.sh` reports "Nothing to repin.", and `bazel mod deps`
leaves `MODULE.bazel.lock` unchanged.
- `bazel run //bazel:buildifier.check` passes.
- `./ci/scripts/rust-lint.sh` passes: `cargo fmt --check`,
workspace-wide `cargo clippy --all-features --all-targets --deny
warnings`, and depcheck.
- The tests the refresh broke pass with the fixes above:
`//rs/execution_environment:execution_environment_test`,
`//rs/recovery/subnet_splitting:integration_test` and
`//rs/nns/governance:governance-canbench_test`. The `//rs/tests/nested`
HostOS tests are left to CI.
- prost-build 0.14.6: all 18 `check_generated_files` tests
(`bazel/prost.bzl`) pass, so the checked-in generated protobuf files are
unchanged.
- `bazel query --keep_going 'deps(//...)'` succeeds, so no BUILD file,
`manual` targets included, references a deleted `crate.spec`.
- `bazel build` of:
- the pkg-config patch's users: `//rs/ic_os/os_tools/guest_disk`,
`//rs/ic_os/device` and `//rs/ic_os/os_tools/guest_vm_runner`;
- the wasm32 canisters that use the getrandom override: rate-limit,
registry, governance and the ckDOGE minter;
- ic-boundary, the HTTPS outcalls adapter, the orchestrator, the
PocketIC server and the replica.
- `bazel build --config=fuzzing --build_tag_filters=libfuzzer //rs/...`:
the 23 libfuzzer targets. PR CI doesn't build them here: CI Main
excludes `fuzz_test` targets, and the fuzzer jobs run only when `.rs`,
`BUILD.bazel`, `.bzl` or fuzzing-script files change.

This PR carries the `CI_ALL_BAZEL_TARGETS` label, so CI Main builds and
tests the same targets as on master, `long_test`s included.

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: IDX GitHub Automation <[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.

3 participants