Skip to content

feat(engine-controller): Let the engine controller set a cloud engine's state limits - #11863

Merged
r-birkner merged 3 commits into
masterfrom
rjb/engine-controller-resource-limits
Oct 21, 2026
Merged

r-birkner merged 3 commits into
masterfrom
rjb/engine-controller-resource-limits

Conversation

@r-birkner

@r-birkner r-birkner commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Lets the engine controller canister set a cloud engine subnet's state limits (maximum_state_size, maximum_state_delta), both when it creates the subnet and afterwards. Today every cloud engine subnet is created with the protocol defaults, whatever hardware its nodes have, and the engine controller cannot change them later. A subnet is only as big as its smallest node, so an engine on small nodes needs tighter limits than the defaults, and an engine whose nodes are upgraded should be able to grow its limits again.

create_engine takes an optional resource_limits (EngineResourceLimits: the two state limits only), forwarded to the new subnet's CreateSubnetPayload. Omitted, the subnet keeps the protocol defaults as before. The field is an opt, so existing callers are unaffected.

update_subnet now also accepts the state limits in resource_limits. As in #11519, the scope check exists twice: in the engine controller proxy (ensure_only_allowed_fields_set) and as the registry's defence-in-depth check (ensure_engine_controller_payload_scope). Both are widened to allow maximum_state_size and maximum_state_delta. The query limits (maximum_query_instructions, maximum_query_walltime_seconds) remain rejected for this caller, along with every other field, and the registry still requires the target to be a CloudEngine subnet.

update_subnet replaces resource_limits as a whole, so an engine controller update would otherwise reset limits it is not allowed to manage, for example query limits set by a proposal. For the engine controller as caller, the registry therefore keeps the current value of every limit the payload leaves unset, as ic-admin does client-side with ResourceLimits::inherit_from. Governance updates keep the existing replace semantics.

Tests:

  • Proxy: ensure_only_allowed_fields_set_accepts_state_limits and _rejects_query_limits.
  • Registry: test_engine_controller_sets_state_limits_and_keeps_unset_limits (a state-size-only update keeps the delta and the governance-set query limits) and test_engine_controller_cannot_set_query_limits, following STANDARDS_AND_CONVENTIONS.md. engine_controller_cannot_update_disallowed_fields now expects the offending field rather than the exact panic wording.
  • PocketIC: create_engine_sets_resource_limits checks that the limits land on the new subnet record.
  • Existing CreateEngineArgs literals, including the standard_engine_replica_version_test system test, pass resource_limits: None.

Both unreleased_changelog.md files are updated.

🤖 Generated with Claude Code

…'s state limits

`create_engine` takes an optional `resource_limits` (`maximum_state_size`,
`maximum_state_delta`), forwarded to the new subnet's `CreateSubnetPayload`.

`update_subnet` accepts those two state limits too, in both the proxy's and
the registry's scope check; the query limits stay governance-only. For the
engine controller as caller, the registry keeps the current value of every
limit the payload leaves unset, so its update never resets the limits it may
not manage.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@r-birkner
r-birkner requested review from a team as code owners October 15, 2026 09:07
@github-actions github-actions Bot added the feat label Oct 15, 2026

@github-actions github-actions Bot 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.

This pull request changes code owned by the Governance team. Therefore, make sure that
you have considered the following (for Governance-owned code):

  1. Update unreleased_changelog.md (if there are behavior changes, even if they are
    non-breaking).

  2. Are there BREAKING changes?

  3. Is a data migration needed?

  4. Security review?

How to Satisfy This Automatic Review

  1. Go to the bottom of the pull request page.

  2. Look for where it says this bot is requesting changes.

  3. Click the three dots to the right.

  4. Select "Dismiss review".

  5. In the text entry box, respond to each of the numbered items in the previous
    section, declare one of the following:

  • Done.

  • $REASON_WHY_NO_NEED. E.g. for unreleased_changelog.md, "No
    canister behavior changes.", or for item 2, "Existing APIs
    behave as before.".

Brief Guide to "Externally Visible" Changes

"Externally visible behavior change" is very often due to some NEW canister API.

Changes to EXISTING APIs are more likely to be "breaking".

If these changes are breaking, make sure that clients know how to migrate, how to
maintain their continuity of operations.

If your changes are behind a feature flag, then, do NOT add entrie(s) to
unreleased_changelog.md in this PR! But rather, add entrie(s) later, in the PR
that enables these changes in production.

Reference(s)

For a more comprehensive checklist, see here.

GOVERNANCE_CHECKLIST_REMINDER_DEDUP

@zeropath-ai

zeropath-ai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

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

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► rs/engine_controller/BUILD.bazel
    Add resource_limits to engine creation dependencies
► rs/engine_controller/Cargo.toml
    Add ic-registry-resource-limits dependency
► rs/engine_controller/canister/canister.rs
    Use ResourceLimits and integrate with CreateSubnetPayload
► rs/engine_controller/src/lib.rs
    Introduce EngineResourceLimits and extend CreateEngineArgs with resource_limits
► rs/engine_controller/tests/tests.rs
    Update tests to include resource_limits in CreateEngineArgs
► rs/engine_controller/unreleased_changelog.md
    Document support for resource_limits in create_engine
► rs/registry/canister/src/mutations/do_update_subnet.rs
    Extend update handling to propagate engine resource_limits and keep unset values when appropriate
► rs/registry/canister/unreleased_changelog.md
    Note engine controller can now set state limits via resource_limits
► rs/engine_controller/engine_controller.did
    Add EngineResourceLimits type and resource_limits to CreateEngineArgs
► rs/engine_controller/tests/tests.rs
    Add tests for resource_limits behavior and propagation
► rs/engine_controller/tests/tests.rs
    Add test for creating engine with resource limits
► rs/engine_controller/canister/tests.rs
    Add tests for state limits behavior and governance overrides
► rs/engine_controller/canister/tests.rs
    Extend tests to verify allowed/disallowed fields with resource_limits

…er limit tests

The new registry tests are named `test_…`, lead with the behavior under
test, and are laid out in the prepare / run / verify steps.
`engine_controller_cannot_update_disallowed_fields` now expects the
offending field rather than the exact wording of the panic.

`create_engine` converts the limits with an explicit `ResourceLimits::from`
instead of a bare `into`, which takes a direct dependency on
`ic-registry-resource-limits`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@r-birkner
r-birkner dismissed github-actions[bot]’s stale review October 15, 2026 09:52
  1. Update unreleased_changelog.md: done
  2. Are there BREAKING changes? No
  3. Is a data migration needed? No
  4. Security review? No

@pierugo-dfinity pierugo-dfinity 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.

Approving core-protocol-owned single-line diff rs/tests/consensus/orchestrator/standard_engine_replica_version_test.rs

@r-birkner
r-birkner added this pull request to the merge queue Oct 21, 2026
Merged via the queue into master with commit 63761b2 Oct 21, 2026
38 checks passed
@r-birkner
r-birkner deleted the rjb/engine-controller-resource-limits branch October 21, 2026 11:56
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.

4 participants