Skip to content

feat: new canister settings minimum_incoming_canister_call_cycles - #10398

Merged
mraszyk merged 35 commits into
masterfrom
mraszyk/minimum-msg-cycles-available
Jun 23, 2026
Merged

mraszyk merged 35 commits into
masterfrom
mraszyk/minimum-msg-cycles-available

Conversation

@mraszyk

@mraszyk mraszyk commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor

This PR introduces a new canister setting minimum_incoming_canister_call_cycles specifying the minimum amount of cycles that must be available as transferred cycles in an incoming inter-canister call from a different canister (i.e., ignoring ingress messages: canister_inspect_message hook can be used to filter them, albeit only via non-replicated execution).

@github-actions github-actions Bot added the feat label Jun 5, 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.

Pull request overview

This PR adds a new canister setting, minimum_msg_cycles_available, to enforce a minimum attached-cycles threshold on incoming inter-canister requests (ingress unaffected), and wires it through the management canister types, replica execution, and checkpoint persistence.

Changes:

  • Extends management canister Candid/Rust types and builders to include minimum_msg_cycles_available.
  • Enforces the minimum in replicated execution for incoming inter-canister Requests, rejecting and refunding when insufficient cycles are attached.
  • Persists the setting in canister state (checkpoint/protobuf) and adds execution environment tests covering status/defaulting and admission behavior.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
rs/types/management_canister_types/tests/ic.did Adds the setting to canister_settings / definite_canister_settings DID test definitions.
rs/types/management_canister_types/src/lib.rs Adds field + builder/getter plumbing for minimum_msg_cycles_available in management types.
rs/state_manager/src/tip.rs Serializes minimum_msg_cycles_available into checkpoint canister state bits.
rs/state_manager/src/checkpoint.rs Loads minimum_msg_cycles_available from checkpoint into system state.
rs/state_layout/src/state_layout.rs Adds minimum_msg_cycles_available to CanisterStateBits.
rs/state_layout/src/state_layout/proto.rs Adds protobuf (de)serialization for the new state bit (with backward-compatible default).
rs/state_layout/src/state_layout/tests.rs Updates default CanisterStateBits used in tests to include the new field.
rs/replicated_state/src/canister_state/system_state.rs Adds minimum_msg_cycles_available to SystemState and initializes it to zero.
rs/execution_environment/src/canister_settings.rs Parses/validates the new setting from CanisterSettingsArgs and adds an out-of-range error.
rs/execution_environment/src/canister_manager.rs Applies setting on update; exposes it via canister_status output.
rs/execution_environment/src/execution_environment.rs Enforces minimum cycles for incoming inter-canister requests (reject + refund).
rs/execution_environment/tests/canister_settings.rs Adds range validation and behavioral tests for the setting (status, ingress unaffected, accept/reject, DTS slicing).
rs/protobuf/def/state/canister_state_bits/v1/canister_state_bits.proto Adds protobuf field minimum_msg_cycles_available = 68.
rs/protobuf/src/gen/state/state.canister_state_bits.v1.rs Regenerates protobuf Rust bindings for the new field.
rs/replica_tests/tests/canister_lifecycle.rs Updates canister status expectations to include the new setting value.
rs/cycles_account_manager/src/cycles_account_manager.rs Bumps max payload size constant due to Candid arg size increase.
rs/pocket_ic_server/src/pocket_ic.rs Extends CanisterSettingsArgs literals to include the new field.
rs/nervous_system/clients/src/update_settings.rs Extends CanisterSettingsArgs conversion to include the new field (set to None).
packages/ic-management-canister-types/tests/ic.did Updates public package DID test definitions with the new setting.
packages/ic-management-canister-types/src/lib.rs Documents and adds minimum_msg_cycles_available to the public types crate.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

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.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.

@mraszyk
mraszyk marked this pull request as ready for review June 8, 2026 12:09
@mraszyk
mraszyk requested review from a team as code owners June 8, 2026 12:09

@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

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.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.

mraszyk and others added 2 commits June 18, 2026 16:02
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@mraszyk
mraszyk marked this pull request as ready for review June 18, 2026 15:18
@zeropath-ai

zeropath-ai Bot commented Jun 18, 2026 •

Copy link
Copy Markdown

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

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► rs/cycles_account_manager/src/cycles_account_manager.rs
    Update MAX_DELAYED_INGRESS_COST_PAYLOAD_SIZE
► rs/execution_environment/src/canister_manager.rs
    Implement minimum_incoming_canister_call_cycles logic for updating canister settings and retrieving canister status.
► rs/execution_environment/src/canister_settings.rs
    Add minimum_incoming_canister_call_cycles to CanisterSettings and related structs.
► rs/execution_environment/src/execution_environment.rs
    Implement logic to reject calls with insufficient cycles based on minimum_incoming_canister_call_cycles, and allow self-calls and ingress messages.
► rs/execution_environment/tests/canister_settings.rs
    Add tests for minimum_incoming_canister_call_cycles validation and behavior in canister status.
    Add tests for minimum_incoming_canister_call_cycles in inter-canister calls, self-calls, and ingress messages.
► rs/protobuf/def/state/canister_state_bits/v1/canister_state_bits.proto
    Add minimum_incoming_canister_call_cycles to CanisterStateBits protobuf definition.
► rs/protobuf/src/gen/state/state.canister_state_bits.v1.rs
    Generate Rust code for CanisterStateBits with minimum_incoming_canister_call_cycles.
► rs/replicated_state/src/canister_state/system_state.rs
    Add minimum_incoming_canister_call_cycles field to SystemState and its constructor.
► rs/state_layout/src/state_layout.rs
    Include minimum_incoming_canister_call_cycles in CanisterStateBits layout.
► rs/state_layout/src/state_layout/proto.rs
    Implement conversion for minimum_incoming_canister_call_cycles between protobuf and CanisterStateBits.
► rs/state_layout/src/state_layout/tests.rs
    Add default value for minimum_incoming_canister_call_cycles in testing.
► rs/state_manager/src/checkpoint.rs
    Include minimum_incoming_canister_call_cycles when loading canister state.
► rs/state_manager/src/tip.rs
    Include minimum_incoming_canister_call_cycles when serializing canister protos.
► rs/types/management_canister_types/src/lib.rs
    Add minimum_incoming_canister_call_cycles to CanisterSettings and DefiniteCanisterSettingsArgs.
► packages/ic-management-canister-types/src/lib.rs
    Add minimum_incoming_canister_call_cycles to CanisterSettings and DefiniteCanisterSettingsArgs.
► packages/ic-management-canister-types/tests/ic.did
    Add minimum_incoming_canister_call_cycles to ic.did for testing.
Refactor ► rs/types/management_canister_types/src/lib.rs
    Add #[allow(clippy::too_many_arguments)] to DefiniteCanisterSettingsArgs::new
Other ► rs/replica_tests/tests/canister_lifecycle.rs
    Add minimum_incoming_canister_call_cycles parameter to can_get_canister_information test

@zeropath-ai

zeropath-ai Bot commented Jun 18, 2026 •

Copy link
Copy Markdown

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

Security Overview
Detected Code Changes

| Change Type | Relevant files

... (code changes summary truncated to fit VCS comment limits.)

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 only for the one Governance-owned file (under nervous_system).

@alin-at-dfinity alin-at-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.

LGTM, modulo the self-calls comment.

@mraszyk
mraszyk added this pull request to the merge queue Jun 23, 2026
@mraszyk
mraszyk removed this pull request from the merge queue due to a manual request Jun 23, 2026
@mraszyk
mraszyk enabled auto-merge June 23, 2026 15:44
@mraszyk
mraszyk added this pull request to the merge queue Jun 23, 2026
Merged via the queue into master with commit 3b1b525 Jun 23, 2026
60 of 62 checks passed
@mraszyk
mraszyk deleted the mraszyk/minimum-msg-cycles-available branch June 23, 2026 17:22
pull Bot pushed a commit to mikeyhodl/ic that referenced this pull request Aug 12, 2026
…ity#11119)

The `status_visibility` canister setting (introduced in dfinity#10667) was only
available in the internal `ic-management-canister-types-private` crate.
Add it to the public crate as well: the `StatusVisibility` type, the
fields on `CanisterSettings` and `DefiniteCanisterSettings`, and the
corresponding entries in `tests/ic.did`.

Also complete the unreleased changelog, which was missing the
`minimum_incoming_canister_call_cycles` field (dfinity#10398) and the tightened
`wasm_memory_threshold` bound (dfinity#10574).

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
basvandijk pushed a commit to Ocheretovich/ic that referenced this pull request Oct 23, 2026
Bump the workspace dependency `ic-management-canister-types` from 0.8.0
to 0.11.0. This is needed for dfinity#11894 (offline derivation of secp256r1
keys in `ic-pub-key`).

Between 0.8.0 and 0.11.0 nothing was removed or renamed. The additions
still break Rust code in places, because none of these types is
`#[non_exhaustive]`:
- `CanisterSettings` and `DefiniteCanisterSettings` gained the fields
`minimum_incoming_canister_call_cycles` and `status_visibility`, along
with the new `StatusVisibility` type.
- `HttpRequestArgs` gained `pricing_version`, and `HttpMethod` gained
`PATCH`.
- New types for flexible HTTP outcalls and subnet metrics.
- `EcdsaCurve` gained `Secp256r1`.

Changes that follow from the bump:
- `canister_test`: one struct literal lists every `CanisterSettings`
field, so it now sets the two new fields as well.
- CMC: `cmc.did` declares the two new `CanisterSettings` fields, because
`test_candid_interface_compatibility` requires it. The CMC now forwards
these two settings in `create_canister` and `notify_create_canister`.
Before, it dropped them. `unreleased_changelog.md` records this. dfinity#10756
did the same for `snapshot_visibility`.
- ckDOGE minter: `ckdoge_minter.did` declares the two new
`DefiniteCanisterSettings` fields, which `get_canister_status` now
returns. The replica returns both fields unconditionally since dfinity#10398
and dfinity#10667, and all mainnet GuestOS versions in
`mainnet-icos-revisions.json` contain both PRs. So decoding
`canister_status` with the new types also works on mainnet.
- Changelogs: `pocket-ic` and `ic-pub-key` re-export these types, so
both record the bump.

The older copies left in `Cargo.lock` come from `ic-utils` and
`evm_rpc_types`, which have no newer release, and from the cdk, which a
follow-up PR bumps.

This does not yet remove the secp256r1 workarounds in the system tests
(`cast_ecdsa_key_id`, the signer canister) and in the PocketIC test
canister. Those are cdk canisters, and the workspace's
`ic-cdk-management-canister` 0.1.1 re-exports the 0.7.1 types. Its 0.3.0
requires `ic-management-canister-types` ^0.11, so this bump comes first.

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

---------

Co-authored-by: Claude Opus 5.5 <[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.

4 participants