Skip to content

feat: management canister's endpoint list_canisters as inter-canister call#10643

Open
mraszyk wants to merge 21 commits into
masterfrom
mraszyk/list-canisters-replicated
Open

feat: management canister's endpoint list_canisters as inter-canister call#10643
mraszyk wants to merge 21 commits into
masterfrom
mraszyk/list-canisters-replicated

Conversation

@mraszyk

@mraszyk mraszyk commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

This PR allows the management canister's endpoint list_canisters to be called as an inter-canister call by subnet admins. The endpoint is evaluated on the same subnet as the calling canister.

@github-actions github-actions Bot added the feat label Jul 3, 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

Enables the management canister method list_canisters to be executed via inter-canister (subnet) messages by subnet-admin canisters, while remaining disallowed via ingress, and introduces round-instruction accounting/deferral for its (potentially heavy) subnet-wide iteration.

Changes:

  • Added ListCanisters to the management canister Method enum and updated routing/effective-canister-id handling so inter-canister calls resolve correctly.
  • Implemented list_canisters execution for subnet messages with explicit round-instruction charging and scheduler deferral when the round instruction budget is exhausted.
  • Added execution tests and benchmarks covering authorization behavior and round-instruction-limit behavior.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
rs/types/types/src/messages/inter_canister.rs Treats list_canisters as having no effective canister ID for inter-canister message routing.
rs/types/types/src/messages/ingress_messages.rs Marks list_canisters as a subnet method not allowed via ingress.
rs/types/management_canister_types/src/lib.rs Adds ListCanisters to ic00::Method.
rs/test_utilities/execution_environment/src/lib.rs Updates test harness assertions to account for list_canisters consuming round instructions without an effective canister ID.
rs/execution_environment/tests/execution_test.rs Adds state-machine tests for success/rejection and round instruction limit behavior for inter-canister list_canisters.
rs/execution_environment/src/scheduler.rs Defers list_canisters subnet messages once round instruction budget is reached; adds to subnet-message instruction-limit classification.
rs/execution_environment/src/query_handler.rs Refactors query-path list_canisters logic to use shared implementation.
rs/execution_environment/src/ic00_permissions.rs Documents/threads ListCanisters through permissions accounting expectations.
rs/execution_environment/src/execution/common.rs Introduces shared list_canisters implementation and its round-instruction cost model.
rs/execution_environment/src/execution_environment/tests.rs Adds tests asserting ingress rejection behavior for list_canisters.
rs/execution_environment/src/execution_environment.rs Adds subnet-message execution handling for ListCanisters, including conditional round-instruction charging.
rs/execution_environment/src/execution_environment_metrics.rs Adds ListCanisters to subnet message metrics method labeling.
rs/execution_environment/src/canister_manager.rs Allows ListCanisters to be handled as an inter-canister-only management call.
rs/execution_environment/benches/management_canister/test_canister/src/main.rs Adds benchmark helper methods to create gapped canister IDs and call list_canisters.
rs/execution_environment/benches/management_canister/test_canister/candid.did Exposes new benchmark helper endpoints in the test canister interface.
rs/execution_environment/benches/management_canister/main.rs Registers list_canisters benchmark module.
rs/execution_environment/benches/management_canister/list_canisters.rs Adds a Criterion benchmark for list_canisters across subnet sizes.
rs/embedders/src/wasmtime_embedder/system_api/sandbox_safe_system_state.rs Threads ListCanisters through system API state-modification classification.
rs/embedders/src/wasmtime_embedder/system_api/routing.rs Routes list_canisters management calls without an effective canister ID (local subnet).

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

@mraszyk mraszyk marked this pull request as ready for review July 6, 2026 16:05
@mraszyk mraszyk requested a review from a team as a code owner July 6, 2026 16:05
@zeropath-ai

zeropath-ai Bot commented Jul 6, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 6a83f24.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► rs/embedders/src/wasmtime_embedder/system_api/routing.rs
    Allow ListCanisters alongside CreateCanister in destination resolution
Enhancement ► rs/embedders/src/wasmtime_embedder/system_api/sandbox_safe_system_state.rs
    Include ListCanisters in allowed Ic00 methods for system state modifications
Enhancement ► rs/execution_environment/benches/management_canister/list_canisters.rs
    Add bench for list_canisters functionality
Enhancement ► rs/execution_environment/benches/management_canister/main.rs
    Register list_canisters benchmark in main bench suite
Enhancement ► rs/execution_environment/benches/management_canister/test_canister/candid.did
    Expose list_canisters in management canister interface
Enhancement ► rs/execution_environment/benches/management_canister/test_canister/src/main.rs
    Implement list_canisters_with_gaps and related CANIRoutines
Enhancement ► rs/execution_environment/src/canister_manager.rs
    Recognize ListCanisters as a valid Ic00 method for subnet-admin context
Enhancement ► rs/execution_environment/src/execution/common.rs
    Import ListCanisters and support encoding/decoding payloads
Enhancement ► rs/execution_environment/src/execution/common.rs
    Add list_canisters handling logic and cost model integration
Enhancement ► rs/execution_environment/src/execution_environment.rs
    Handle ListCanisters subnet messages with instruction deduction on success
Enhancement ► rs/execution_environment/src/execution_environment_metrics.rs
    Treat ListCanisters as an Ic00 method in metrics */
Enhancement ► rs/execution_environment/src/ic00_permissions.rs
    Document ListCanisters behavior in permissions cost model
Enhancement ► rs/execution_environment/src/query_handler.rs
    ListCanisters support in query path (adjust imports and handling)
Enhancement ► rs/execution_environment/src/scheduler.rs
    Defer ListCanisters execution when round instructions are exhausted
Enhancement ► rs/execution_environment/tests/execution_test.rs
    Add tests around list_canisters permission and behavior via ingress/inter-canister calls
Enhancement ► rs/types/management_canister_types/src/lib.rs
    Add ListCanisters to Method enum
Enhancement ► rs/types/types/src/canister_log.rs
    Add constant checks related to fetch logs payload sizing for inter-canister calls
Enhancement ► rs/types/types/src/messages/ingress_messages.rs
    Treat ListCanisters as a possible Method in ingress path mapping
Enhancement ► rs/types/types/src/messages/inter_canister.rs
    Allow ListCanisters in inter-canister method matching

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.

2 participants