Skip to content

chore: Bump current certification version to V29 - #11184

Merged
mraszyk merged 8 commits into
masterfrom
mraszyk/bump-cert-version-v29
Sep 15, 2026
Merged

mraszyk merged 8 commits into
masterfrom
mraszyk/bump-cert-version-v29

Conversation

@mraszyk

@mraszyk mraszyk commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

All mainnet subnets run replica versions supporting up to 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.

Tests

The cycles consumed by the canisters that still exist are not persisted: they are derived by ReplicatedState::new_from_checkpoint on load and refreshed by StateManagerImpl::commit_and_certify on every committed state. Now that /subnet/<subnet_id>/metrics certifies them, three StateMachine tests pin that, as promised in #11297.

  • subnet_metrics_are_unchanged_across_a_restart writes a checkpoint and restarts the node, asserting the same SubnetMetrics and the same certified /subnet/<subnet_id>/metrics leaf, read via read_certified_state.
  • consumed_cycles_in_subnet_metrics_are_refreshed_every_round installs 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_deleted deletes 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 into consumed_cycles_by_deleted_canisters.

🤖 Generated with Claude Code

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 mraszyk added the CI_ALL_BAZEL_TARGETS Runs all bazel targets label Aug 18, 2026
@github-actions github-actions Bot added the chore label Aug 18, 2026
mraszyk and others added 2 commits September 14, 2026 12:44
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]>

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

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]>

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

The version bump, fixtures, dependencies, and targeted regression coverage are consistent and complete.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

…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]>

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

The version bump is consistent with existing V29 support and is covered by targeted regression tests.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

…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]>

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

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]>

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

The version bump, dependent hashes, build dependency, and targeted regression coverage are consistent and complete.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@mraszyk
mraszyk marked this pull request as ready for review September 14, 2026 16:37
@mraszyk
mraszyk requested a review from a team as a code owner September 14, 2026 16:37
@zeropath-ai

zeropath-ai Bot commented Sep 14, 2026

Copy link
Copy Markdown

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

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► rs/canonical_state/certification_version/src/lib.rs
    public constant CURRENT_CERTIFICATION_VERSION updated from V28 to V29
► rs/execution_environment/BUILD.bazel
    added dependency "//rs/crypto/tree_hash" to rust_ic_test_suite
Enhancement ► rs/execution_environment/tests/execution_test.rs
    import updates for ic_crypto_tree_hash and related types
► rs/execution_environment/tests/execution_test.rs
    extend tests with certified subnet metrics helper functions and substantial test code changes (new functions and tests for subnet metrics across restarts, refresh behavior, and deletions)
Bug Fix / Refactor ► rs/state_manager/src/manifest/split/tests.rs
    update expected hash values for system metadata chunks (two hash arrays changed)

@mraszyk
mraszyk added this pull request to the merge queue Sep 15, 2026
Merged via the queue into master with commit 49395cf Sep 15, 2026
80 of 81 checks passed
@mraszyk
mraszyk deleted the mraszyk/bump-cert-version-v29 branch September 15, 2026 09:05
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.
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