Repository navigation
feat: new canister settings minimum_incoming_canister_call_cycles - #10398
Conversation
There was a problem hiding this comment.
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.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
There was a problem hiding this comment.
This pull request changes code owned by the Governance team. Therefore, make sure that
you have considered the following (for Governance-owned code):
-
Update
unreleased_changelog.md(if there are behavior changes, even if they are
non-breaking). -
Are there BREAKING changes?
-
Is a data migration needed?
-
Security review?
How to Satisfy This Automatic Review
-
Go to the bottom of the pull request page.
-
Look for where it says this bot is requesting changes.
-
Click the three dots to the right.
-
Select "Dismiss review".
-
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
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
|
✅ No security or compliance issues detected. Reviewed everything up to a20524c. Security OverviewDetected Code Changes
|
|
✅ No security or compliance issues detected. Reviewed everything up to a20524c. Security OverviewDetected Code Changes| Change Type | Relevant files ... (code changes summary truncated to fit VCS comment limits.) |
daniel-wong-dfinity-org-twin
left a comment
There was a problem hiding this comment.
Approving only for the one Governance-owned file (under nervous_system).
…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]>
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]>
This PR introduces a new canister setting
minimum_incoming_canister_call_cyclesspecifying 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_messagehook can be used to filter them, albeit only via non-replicated execution).