Skip to content

Commit

Permalink
Update Candid Files (#631)
Browse files Browse the repository at this point in the history
# Motivation
The canisters APIs have been updated.

# Changes
* Updated the candid interface files for the canisters used in this
library.
* Updated the javascript bindings for the latest candid interfaces.

# Tests
- [ ] Please check the API updates for any breaking changes that affect
our code.

---------

Signed-off-by: David Dal Busco <[email protected]>
Co-authored-by: gix-bot <[email protected]>
Co-authored-by: David Dal Busco <[email protected]>
  • Loading branch information
3 people authored May 21, 2024
1 parent d6ad2a4 commit 7eae0e4
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 2024.XX.YY-hhmmZ

## Features

- Canister status response extended with query statistics.

# 2024.05.14-0630Z

## Overview
Expand Down
17 changes: 15 additions & 2 deletions packages/ic-management/candid/ic-management.certified.idl.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ export const idlFactory = ({ IDL }) => {
'memory_size' : IDL.Nat,
'cycles' : IDL.Nat,
'settings' : definite_canister_settings,
'query_stats' : IDL.Record({
'response_payload_bytes_total' : IDL.Nat,
'num_instructions_total' : IDL.Nat,
'num_calls_total' : IDL.Nat,
'request_payload_bytes_total' : IDL.Nat,
}),
'idle_cycles_burned_per_day' : IDL.Nat,
'module_hash' : IDL.Opt(IDL.Vec(IDL.Nat8)),
'reserved_cycles' : IDL.Nat,
Expand Down Expand Up @@ -190,7 +196,14 @@ export const idlFactory = ({ IDL }) => {
});
const canister_install_mode = IDL.Variant({
'reinstall' : IDL.Null,
'upgrade' : IDL.Opt(IDL.Record({ 'skip_pre_upgrade' : IDL.Opt(IDL.Bool) })),
'upgrade' : IDL.Opt(
IDL.Record({
'wasm_memory_persistence' : IDL.Opt(
IDL.Variant({ 'keep' : IDL.Null, 'replace' : IDL.Null })
),
'skip_pre_upgrade' : IDL.Opt(IDL.Bool),
})
),
'install' : IDL.Null,
});
const chunk_hash = IDL.Record({ 'hash' : IDL.Vec(IDL.Nat8) });
Expand Down Expand Up @@ -218,7 +231,7 @@ export const idlFactory = ({ IDL }) => {
const node_metrics = IDL.Record({
'num_block_failures_total' : IDL.Nat64,
'node_id' : IDL.Principal,
'num_blocks_total' : IDL.Nat64,
'num_blocks_proposed_total' : IDL.Nat64,
});
const node_metrics_history_result = IDL.Vec(
IDL.Record({
Expand Down
21 changes: 19 additions & 2 deletions packages/ic-management/candid/ic-management.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,18 @@ export interface canister_info_result {
}
export type canister_install_mode =
| { reinstall: null }
| { upgrade: [] | [{ skip_pre_upgrade: [] | [boolean] }] }
| {
upgrade:
| []
| [
{
wasm_memory_persistence:
| []
| [{ keep: null } | { replace: null }];
skip_pre_upgrade: [] | [boolean];
},
];
}
| { install: null };
export interface canister_settings {
freezing_threshold: [] | [bigint];
Expand All @@ -83,6 +94,12 @@ export interface canister_status_result {
memory_size: bigint;
cycles: bigint;
settings: definite_canister_settings;
query_stats: {
response_payload_bytes_total: bigint;
num_instructions_total: bigint;
num_calls_total: bigint;
request_payload_bytes_total: bigint;
};
idle_cycles_burned_per_day: bigint;
module_hash: [] | [Uint8Array | number[]];
reserved_cycles: bigint;
Expand Down Expand Up @@ -188,7 +205,7 @@ export type millisatoshi_per_byte = bigint;
export interface node_metrics {
num_block_failures_total: bigint;
node_id: Principal;
num_blocks_total: bigint;
num_blocks_proposed_total: bigint;
}
export interface node_metrics_history_args {
start_at_timestamp_nanos: bigint;
Expand Down
12 changes: 11 additions & 1 deletion packages/ic-management/candid/ic-management.did
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ type millisatoshi_per_byte = nat64;

type node_metrics = record {
node_id : principal;
num_blocks_total : nat64;
num_blocks_proposed_total : nat64;
num_block_failures_total : nat64;
};

Expand Down Expand Up @@ -183,6 +183,10 @@ type canister_install_mode = variant {
reinstall;
upgrade : opt record {
skip_pre_upgrade : opt bool;
wasm_memory_persistence : opt variant {
keep;
replace;
};
};
};

Expand Down Expand Up @@ -229,6 +233,12 @@ type canister_status_result = record {
cycles : nat;
reserved_cycles : nat;
idle_cycles_burned_per_day : nat;
query_stats: record {
num_calls_total: nat;
num_instructions_total: nat;
request_payload_bytes_total: nat;
response_payload_bytes_total: nat;
};
};

type canister_info_args = record {
Expand Down
17 changes: 15 additions & 2 deletions packages/ic-management/candid/ic-management.idl.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ export const idlFactory = ({ IDL }) => {
'memory_size' : IDL.Nat,
'cycles' : IDL.Nat,
'settings' : definite_canister_settings,
'query_stats' : IDL.Record({
'response_payload_bytes_total' : IDL.Nat,
'num_instructions_total' : IDL.Nat,
'num_calls_total' : IDL.Nat,
'request_payload_bytes_total' : IDL.Nat,
}),
'idle_cycles_burned_per_day' : IDL.Nat,
'module_hash' : IDL.Opt(IDL.Vec(IDL.Nat8)),
'reserved_cycles' : IDL.Nat,
Expand Down Expand Up @@ -190,7 +196,14 @@ export const idlFactory = ({ IDL }) => {
});
const canister_install_mode = IDL.Variant({
'reinstall' : IDL.Null,
'upgrade' : IDL.Opt(IDL.Record({ 'skip_pre_upgrade' : IDL.Opt(IDL.Bool) })),
'upgrade' : IDL.Opt(
IDL.Record({
'wasm_memory_persistence' : IDL.Opt(
IDL.Variant({ 'keep' : IDL.Null, 'replace' : IDL.Null })
),
'skip_pre_upgrade' : IDL.Opt(IDL.Bool),
})
),
'install' : IDL.Null,
});
const chunk_hash = IDL.Record({ 'hash' : IDL.Vec(IDL.Nat8) });
Expand Down Expand Up @@ -218,7 +231,7 @@ export const idlFactory = ({ IDL }) => {
const node_metrics = IDL.Record({
'num_block_failures_total' : IDL.Nat64,
'node_id' : IDL.Principal,
'num_blocks_total' : IDL.Nat64,
'num_blocks_proposed_total' : IDL.Nat64,
});
const node_metrics_history_result = IDL.Vec(
IDL.Record({
Expand Down
6 changes: 6 additions & 0 deletions packages/ic-management/src/ic-management.canister.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,12 @@ describe("ICManagementCanister", () => {
idle_cycles_burned_per_day: BigInt(0),
module_hash: [],
reserved_cycles: BigInt(11),
query_stats: {
num_calls_total: 100n,
num_instructions_total: 100_000n,
response_payload_bytes_total: 200n,
request_payload_bytes_total: 300n,
},
};
const service = mock<IcManagementService>();
service.canister_status.mockResolvedValue(response);
Expand Down
3 changes: 2 additions & 1 deletion packages/ic-management/src/types/ic-management.params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ export const toInstallMode = (
case InstallMode.Reinstall:
return { reinstall: null };
case InstallMode.Upgrade:
// TODO: Support Upgrade mode skipping pre-upgrade
// TODO: Support Upgrade mode skipping pre-upgrade and wasm_memory_persistence
// `upgrade` can also have `[{ skip_pre_upgrade: [] | [boolean] }]`
// or wasm_memory_persistence : opt variant { keep; replace; };
return { upgrade: [] };
}
};
Expand Down

0 comments on commit 7eae0e4

Please sign in to comment.