Repository navigation
Conversation
External canisters registered for cycle monitoring without their own obtain-cycles options inherited the station's global obtain strategy. Register them with explicit obtain options that never obtain cycles, both when monitoring starts and when it is restored after an upgrade, and only accept an empty or `Disabled` obtain strategy when starting to monitor an external canister. The station and upgrader keep using the global strategy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rr5M1gYD2ZN6MC7Zs2UFxf
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Regression coverage is needed to verify funding isolation while preserving station-balance top-ups across restoration and global-strategy changes.
1 open issue
What changed in this PR
This PR isolates external-canister funding from the station’s global cycle-obtaining strategy.
Changes:
- Registers external monitors with explicit no-obtain options.
- Uses this registration for new and restored monitors.
- Rejects external obtain strategies other than empty or
Disabled.
| File | Description |
|---|---|
| core/station/impl/src/services/external_canister.rs | Updates monitor registration, restoration, and strategy validation. |
| core/station/impl/src/services/cycle_manager.rs | Adds external registration with a no-obtain override. |
Review effort: Balanced
Add unit tests for starting and restoring external canister monitors with cycle obtain strategies, and an integration test that checks monitored external canisters are topped up from the station's balance, including after an upgrade, and never obtain cycles from the station's ICP account. Use the test-safe print helper in the cycle manager so that it can be exercised in unit tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rr5M1gYD2ZN6MC7Zs2UFxf
aterga
marked this pull request as ready for review
October 21, 2026 08:45
|
✅ No security or compliance issues detected. Reviewed everything up to c519d22. Security OverviewDetected Code Changes
|
sea-snake
approved these changes
Oct 21, 2026
This branch has not been deployed
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.

Summary
External canisters monitored by the station could inherit the station's global obtain-cycles strategy when they had no obtain options of their own. This PR stops that:
CycleManager::add_external_canisterregisters an external canister with explicit obtain options that never obtain cycles. canfund therefore never falls back to the global strategy for it, including when the global strategy changes later.canister_monitor_startandcanister_monitor_restart(monitors restored after an upgrade) both use the new registration.canister_monitor_startnow accepts only an empty orDisabledobtain strategy. Previously it rejected onlyMintFromNativeToken.crate::core::ic_cdk::api::print, so it can run in unit tests.Behaviour change: external canisters can only be topped up from the station's own cycles balance. While the station itself is low on cycles, external canisters are not topped up. Any stored monitor with an explicit per-canister obtain strategy has that strategy ignored after the upgrade.
Testing
canister_monitor_start_rejects_cycle_obtain_strategiesmonitored_external_canisters_never_obtain_cycles: covers fresh and restored monitors, with the global strategy set before registration and changed after itexternal_canisters_are_funded_only_from_station_balance:cargo test -p station: 411 passed.cargo fmt --checkandcargo clippyare clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01Rr5M1gYD2ZN6MC7Zs2UFxf