refactor: validate_and_update_canister_settings#9996
refactor: validate_and_update_canister_settings#9996
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors canister settings handling in the execution environment by removing the previous “validate then apply” split and instead validating + mutating canister settings in a single pass, with the intent of eliminating .expect() panics and relying on cloned state / rollback for failure cases.
Changes:
- Removed
ValidatedCanisterSettingsand the separatevalidate_*/do_update_settings()pipeline, replacing it withvalidate_and_update_canister_settings()that mutatesCanisterStateandRoundLimitsdirectly. - Updated canister creation flow to snapshot and restore
round_limitson failure, and added a regression test for reverting subnet available memory when creation fails mid-way. - Adjusted
update_settingsto use the new combined validate+apply flow.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| rs/execution_environment/src/canister_settings.rs | Removes the now-obsolete ValidatedCanisterSettings type. |
| rs/execution_environment/src/canister_manager.rs | Replaces validate/apply split with a combined validate+mutate function; updates update/create flows accordingly. |
| rs/execution_environment/src/canister_manager/tests.rs | Adds a test ensuring subnet available memory is reverted when canister creation fails after partial resource updates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Refactored CanisterManager to eliminate the validate/apply split for canister settings by merging both functions into a single
validate_and_update_canister_settingsfunction that validates and mutates in one pass, removing all.expect()panics.This is possible now that