Skip to content

refactor: add proxy dispatch module and use ic-management-canister-types#482

Merged
lwshang merged 4 commits intomainfrom
lwshang/dispatch_and_mgmt_types
Apr 2, 2026
Merged

refactor: add proxy dispatch module and use ic-management-canister-types#482
lwshang merged 4 commits intomainfrom
lwshang/dispatch_and_mgmt_types

Conversation

@lwshang
Copy link
Copy Markdown
Contributor

@lwshang lwshang commented Apr 2, 2026

Summary

  • Introduce a new operations::proxy module with update_or_proxy_raw and update_or_proxy helpers that centralize the logic for dispatching canister update calls either directly or through a proxy canister. This replaces duplicated proxy-routing code in canister call and canister create.
  • Replace the hand-rolled management canister types (MgmtCreateCanisterArgs, MgmtCreateCanisterResponse, CanisterSettingsArg, LogVisibility) in icp-canister-interfaces with the upstream ic-management-canister-types crate, removing the management_canister module entirely.
  • Remove the redundant local LogVisibility enum that mirrored ic_management_canister_types::LogVisibility. Settings::log_visibility now uses LogVisibilityDef directly and converts straight to the IC management type, removing ~50 lines of boilerplate.

Test plan

  • Existing tests pass (cargo test)
  • cargo clippy and cargo fmt clean

🤖 Generated with Claude Code

lwshang and others added 3 commits April 2, 2026 10:52
Move the proxy-or-direct update call dispatch into a shared
`operations::call::update_or_proxy_call` function, replacing the
duplicated proxy handling in `commands/canister/call.rs` and
`operations/create.rs`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rename operations/call.rs to operations/proxy.rs. Rename functions to
update_or_proxy_raw and update_or_proxy. Add a higher-level
update_or_proxy that accepts ArgumentEncoder/ArgumentDecoder for typed
Candid encoding/decoding. Refactor create_proxy to use the typed helper
with ic-management-canister-types (CreateCanisterArgs, CanisterIdRecord).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…canister-types

Remove the `management_canister` module from `icp-canister-interfaces`
and use `CanisterSettings`, `CreateCanisterArgs`, `CanisterIdRecord`,
and `LogVisibility` from the `ic-management-canister-types` crate
instead. This eliminates duplicated type definitions and ensures
consistency with the upstream IC interface types.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lwshang lwshang marked this pull request as ready for review April 2, 2026 15:11
@lwshang lwshang requested a review from a team as a code owner April 2, 2026 15:11
@lwshang lwshang enabled auto-merge (squash) April 2, 2026 15:12
@lwshang lwshang disabled auto-merge April 2, 2026 15:12
…yDef directly

The local LogVisibility enum was a 1:1 mirror of
ic_management_canister_types::LogVisibility. Replace it with
LogVisibilityDef as the Settings field type and convert directly
to the IC management type, removing ~50 lines of boilerplate.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lwshang lwshang enabled auto-merge (squash) April 2, 2026 16:34
@lwshang lwshang merged commit 2ef15a4 into main Apr 2, 2026
89 checks passed
@lwshang lwshang deleted the lwshang/dispatch_and_mgmt_types branch April 2, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants