Repository navigation
chore: Bump current certification version to V29 - #11184
Merged
Merged
Conversation
All mainnet subnets run replica versions supporting up to `V29` (`release-2026-08-06_04-21-fix-repro` and `release-2026-08-13_03-55-base`, both with `MAX_SUPPORTED_CERTIFICATION_VERSION == V29`), so the current certification version can be bumped to `V29`. This makes the fixed `consumed_cycles_total` (which no longer double counts the cycles consumed by deleted canisters and additionally includes the cycles consumed by all non-deleted canisters) visible in `/subnet/<subnet_id>/metrics`. `SystemMetadata` encodes the current certification version, hence the expected hashes in `rs/state_manager/src/manifest/split/tests.rs` had to be updated. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
mraszyk
commented
Aug 25, 2026
From certification version `V29` on, `/subnet/<subnet_id>/metrics` certifies `SubnetMetrics::consumed_cycles_total_including_canisters`, whose canisters' part is transient: it is never persisted, but derived by `ReplicatedState::new_from_checkpoint` on load and refreshed by `StateManagerImpl::commit_and_certify` on every committed state. Two `StateMachine` tests pin that, as promised when the field was introduced. `subnet_metrics_are_unchanged_across_a_restart` builds up both a persisted part (a deleted canister) and a transient one (a live canister that burned cycles), writes a checkpoint and restarts the node. It asserts the restarted replica resumes at the same height, with the same `SubnetMetrics` -- and, reading `/subnet/<subnet_id>/metrics` through `read_certified_state`, certifying the same leaf under the same canonical state tree root hash. Were the two to disagree, a restarted replica could no longer help certify the states its peers compute. `consumed_cycles_in_subnet_metrics_are_refreshed_every_round` installs a heartbeat that burns a fixed amount of cycles, so that every single round consumes cycles, and only on that canister. After each tick it recomputes the aggregate from the state itself -- the subnet-level total plus the consumption of the canisters that exist -- asserts the stored one matches, and that it grew by at least the burned amount; a round that skipped the refresh would fall behind. A final canister deletion checks that the canisters' part and `consumed_cycles_by_deleted_canisters` move in lockstep, neither counting the canister twice nor dropping it. Both tests fail if the derivation in `new_from_checkpoint` or the refresh in `commit_and_certify` is removed, and the second one also if the refresh is made to skip rounds. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused version bump is consistent with existing V29 support and is covered by relevant regression tests.
Pull request overview
Bumps canonical-state certification to V29, enabling corrected subnet cycle metrics.
Changes:
- Sets V29 as the current certification version.
- Adds restart and per-round refresh regression tests.
- Updates Bazel dependencies and expected metadata hashes.
File summaries
| File | Description |
|---|---|
rs/canonical_state/certification_version/src/lib.rs |
Activates certification V29. |
rs/execution_environment/tests/execution_test.rs |
Tests cycle metrics across rounds and restarts. |
rs/execution_environment/BUILD.bazel |
Adds the tree-hash test dependency. |
rs/state_manager/src/manifest/split/tests.rs |
Updates V29 metadata hashes. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Recompute the subnet-level summand from the state as well, field by field -- the three scalars plus the three use cases that are only ever recorded at the subnet level -- rather than reading it back from `SubnetMetrics::consumed_cycles_total()`. Leaving out the canister-level entries of `consumed_cycles_by_use_case` is what makes the check independent: adding them would count a deleted canister twice, which the assertion now catches instead of inheriting. Pin the deletion exactly. The aggregate grows by exactly the victim's burned balance, its consumption merely moving from the canisters' part into `consumed_cycles_by_deleted_canisters`; what the canister that stays behind consumes meanwhile is measured rather than bounded, so the comparison can be an equality. The previous lower bound passed just as happily when the victim was counted twice. Also drop `set_checkpoints_enabled(true)` from the restart test, as `checkpointed_tick()` already writes the one checkpoint the restart needs without checkpointing every round; raise the heartbeat's burn to 1e9 cycles per round; and drop a sentence from the restart test's doc comment. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…l total Listing the six accessors by hand recomputed today's subnet-level total correctly, but silently: a use case added later that is only ever recorded at the subnet level would be left out of the recomputation, and the assertion would keep passing against a total that does include it. Walk `CyclesUseCase::iter()` instead -- the enum already derives strum's `EnumIter` -- and classify every variant in an exhaustive match, so a new one does not compile until it has been placed on one side or the other. The three scalar fields stay as they are, having no use case entry to iterate over. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…letion case
The recomputed subnet-level total no longer sums in
`consumed_cycles_{http,ecdsa}_outcalls`. Those two scalars are supersets of their
use case entries, so adding them means recomputing the total out of the very
bookkeeping the assertion is meant to check. No test using the helper makes an
outcall, so both are asserted zero instead: a test that starts making one fails
there, rather than quietly comparing against a total it no longer accounts for.
Split the canister deletion out of
`consumed_cycles_in_subnet_metrics_are_refreshed_every_round` into its own test.
The heartbeat that makes every round consume cycles was also consuming them
while the deletion executed, so the deletion's effect on the aggregate could
only be pinned by measuring that interference and adding it back. On a subnet
holding nothing but the victim there is no interference to measure: the total
grows by exactly the balance burned with it, its consumption having merely moved
from the canisters' part into `consumed_cycles_by_deleted_canisters`.
Each mutation now falls to a single test: dropping the derivation in
`new_from_checkpoint` to the restart test, skipping rounds in the refresh to the
per-round test, and double counting deleted canisters to the deletion test.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Activating a new canonical-state certification version requires final human validation of mainnet rollout compatibility.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Balanced
…tion No test using the helper makes an outcall, requests a threshold signature or drops a message, so the whole subnet-level summand is `consumed_cycles_by_deleted_canisters`. Assert exactly that, in one line, in place of the walk over `CyclesUseCase::iter()` that classified every variant and summed the subnet-only entries -- entries which were zero throughout. The single assertion carries what the walk carried: a test that starts producing any other subnet-level consumption fails here rather than quietly comparing against a total it no longer accounts for, and `consumed_cycles_total()` growing past the deleted canisters' consumption -- which is what counting them twice looks like -- is caught on the spot. The mutation battery is unchanged: dropping the derivation in `new_from_checkpoint` still falls to the restart test, skipping rounds in the refresh to the per-round test, and double counting deleted canisters to the deletion test. This drops the `strum` test dependency again, added one commit ago for the walk. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
✅ No security or compliance issues detected. Reviewed everything up to 97c5efc. Security OverviewDetected Code Changes
|
schneiderstefan
approved these changes
Sep 15, 2026
pull Bot
pushed a commit
to bit-cook/ic
that referenced
this pull request
Sep 21, 2026
Sorry for the back-and-forth 😅 When reenabling the system test in dfinity#11599, I had successfully tested it locally but had not pulled master completely, and in particular, did not include dfinity#11184. Unfortunately, the latter change is exactly the type of changes that are "incompatible" when using the HEAD version of `ic-replay`/`ic-recovery`, as mentioned [here](https://github.com/dfinity/ic/blob/45abaf452188db7d8a45f09529e46f8a46bab165/rs/tests/testnets/mainnet_nns/src/lib.rs#L77-L78). Once dfinity#11203 reaches mainnet NNS, we'll be able to reenable the system test. Will wait until then.
alin-at-dfinity
pushed a commit
that referenced
this pull request
Sep 22, 2026
Sorry for the back-and-forth 😅 When reenabling the system test in #11599, I had successfully tested it locally but had not pulled master completely, and in particular, did not include #11184. Unfortunately, the latter change is exactly the type of changes that are "incompatible" when using the HEAD version of `ic-replay`/`ic-recovery`, as mentioned [here](https://github.com/dfinity/ic/blob/45abaf452188db7d8a45f09529e46f8a46bab165/rs/tests/testnets/mainnet_nns/src/lib.rs#L77-L78). Once #11203 reaches mainnet NNS, we'll be able to reenable the system test. Will wait until then.
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.
All mainnet subnets run replica versions supporting up to
V29, so the current certification version can be bumped toV29.This makes the fixed
consumed_cycles_total(which no longer double counts the cycles consumed by deleted canisters and additionally includes the cycles consumed by all non-deleted canisters) visible in/subnet/<subnet_id>/metrics.SystemMetadataencodes the current certification version, hence the expected hashes inrs/state_manager/src/manifest/split/tests.rshad to be updated.Tests
The cycles consumed by the canisters that still exist are not persisted: they are derived by
ReplicatedState::new_from_checkpointon load and refreshed byStateManagerImpl::commit_and_certifyon every committed state. Now that/subnet/<subnet_id>/metricscertifies them, threeStateMachinetests pin that, as promised in #11297.subnet_metrics_are_unchanged_across_a_restartwrites a checkpoint and restarts the node, asserting the sameSubnetMetricsand the same certified/subnet/<subnet_id>/metricsleaf, read viaread_certified_state.consumed_cycles_in_subnet_metrics_are_refreshed_every_roundinstalls a heartbeat burning cycles every round, and after each tick asserts the aggregate against one recomputed from the state, and that it grew by at least the burned amount.consumed_cycles_in_subnet_metrics_are_refreshed_when_a_canister_is_deleteddeletes the only canister on the subnet, so that nothing else consumes cycles meanwhile and the aggregate can be pinned to exactly the balance burned with it -- the canister's consumption having merely moved from the canisters' part intoconsumed_cycles_by_deleted_canisters.🤖 Generated with Claude Code