Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/check-spec-drift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ on:
pull_request:

env:
# The dfinity/portal commit that pic-js is currently aligned with.
# The dfinity/developer-docs commit that pic-js is currently aligned with.
# Update this after syncing management-canister.ts with a newer spec.
# 2026/03/10: allow PUT/DELETE in http calls
IC_SPEC_PINNED_COMMIT: '415b6182079cabf7926231af12405032fdc62319'
# 2026/09/17: canister settings and status, canister log filters; the HTTP
# outcall changes of this spec version are tracked in #302
IC_SPEC_PINNED_COMMIT: '707596dcf4b5d55ec905368fd60f2d6b5b8981cf'

jobs:
check_spec_drift:
Expand Down
57 changes: 55 additions & 2 deletions packages/pic/src/management-canister.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,28 @@ export type SnapshotVisibility =
| { public: null }
| { allowed_viewers: Principal[] };

const StatusVisibility = IDL.Variant({
controllers: IDL.Null,
public: IDL.Null,
allowed_viewers: IDL.Vec(IDL.Principal),
});

export type StatusVisibility =
| { controllers: null }
| { public: null }
| { allowed_viewers: Principal[] };

export interface CanisterSettings {
controllers: [] | [Principal[]];
compute_allocation: [] | [bigint];
memory_allocation: [] | [bigint];
freezing_threshold: [] | [bigint];
reserved_cycles_limit: [] | [bigint];
minimum_incoming_canister_call_cycles: [] | [bigint];
log_visibility: [] | [LogVisibility];
snapshot_visibility: [] | [SnapshotVisibility];
log_memory_limit: [] | [bigint];
snapshot_visibility: [] | [SnapshotVisibility];
status_visibility: [] | [StatusVisibility];
wasm_memory_limit: [] | [bigint];
wasm_memory_threshold: [] | [bigint];
environment_variables: [] | [EnvironmentVariable[]];
Expand All @@ -56,9 +69,11 @@ export const CanisterSettings = IDL.Record({
memory_allocation: IDL.Opt(IDL.Nat),
freezing_threshold: IDL.Opt(IDL.Nat),
reserved_cycles_limit: IDL.Opt(IDL.Nat),
minimum_incoming_canister_call_cycles: IDL.Opt(IDL.Nat),
log_visibility: IDL.Opt(LogVisibility),
snapshot_visibility: IDL.Opt(SnapshotVisibility),
log_memory_limit: IDL.Opt(IDL.Nat),
snapshot_visibility: IDL.Opt(SnapshotVisibility),
status_visibility: IDL.Opt(StatusVisibility),
wasm_memory_limit: IDL.Opt(IDL.Nat),
wasm_memory_threshold: IDL.Opt(IDL.Nat),
environment_variables: IDL.Opt(IDL.Vec(EnvironmentVariable)),
Expand Down Expand Up @@ -223,7 +238,11 @@ const DefiniteCanisterSettings = IDL.Record({
memory_allocation: IDL.Nat,
freezing_threshold: IDL.Nat,
reserved_cycles_limit: IDL.Nat,
minimum_incoming_canister_call_cycles: IDL.Nat,
log_visibility: LogVisibility,
log_memory_limit: IDL.Nat,
snapshot_visibility: SnapshotVisibility,
status_visibility: StatusVisibility,
wasm_memory_limit: IDL.Nat,
wasm_memory_threshold: IDL.Nat,
environment_variables: IDL.Vec(EnvironmentVariable),
Expand All @@ -235,7 +254,11 @@ export interface DefiniteCanisterSettings {
memory_allocation: bigint;
freezing_threshold: bigint;
reserved_cycles_limit: bigint;
minimum_incoming_canister_call_cycles: bigint;
log_visibility: LogVisibility;
log_memory_limit: bigint;
snapshot_visibility: SnapshotVisibility;
status_visibility: StatusVisibility;
wasm_memory_limit: bigint;
wasm_memory_threshold: bigint;
environment_variables: EnvironmentVariable[];
Expand All @@ -255,15 +278,42 @@ export interface QueryStats {
response_payload_bytes_total: bigint;
}

const MemoryMetrics = IDL.Record({
wasm_memory_size: IDL.Nat,
stable_memory_size: IDL.Nat,
global_memory_size: IDL.Nat,
wasm_binary_size: IDL.Nat,
custom_sections_size: IDL.Nat,
canister_history_size: IDL.Nat,
wasm_chunk_store_size: IDL.Nat,
snapshots_size: IDL.Nat,
log_memory_store_size: IDL.Nat,
});

export interface MemoryMetrics {
wasm_memory_size: bigint;
stable_memory_size: bigint;
global_memory_size: bigint;
wasm_binary_size: bigint;
custom_sections_size: bigint;
canister_history_size: bigint;
wasm_chunk_store_size: bigint;
snapshots_size: bigint;
log_memory_store_size: bigint;
}

const CanisterStatusResponse = IDL.Record({
status: IDL.Variant({
running: IDL.Null,
stopping: IDL.Null,
stopped: IDL.Null,
}),
ready_for_migration: IDL.Bool,
version: IDL.Nat64,
settings: DefiniteCanisterSettings,
module_hash: IDL.Opt(IDL.Vec(IDL.Nat8)),
memory_size: IDL.Nat,
memory_metrics: MemoryMetrics,
cycles: IDL.Nat,
reserved_cycles: IDL.Nat,
idle_cycles_burned_per_day: IDL.Nat,
Expand All @@ -272,9 +322,12 @@ const CanisterStatusResponse = IDL.Record({

export interface CanisterStatusResponse {
status: { running: null } | { stopping: null } | { stopped: null };
ready_for_migration: boolean;
version: bigint;
settings: DefiniteCanisterSettings;
module_hash: [] | [Uint8Array];
memory_size: bigint;
memory_metrics: MemoryMetrics;
cycles: bigint;
reserved_cycles: bigint;
idle_cycles_burned_per_day: bigint;
Expand Down
Loading
Loading