Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Specify the resource reservation mechanism
Browse files Browse the repository at this point in the history
Context:

  - https://forum.dfinity.org/t/23447
  - https://dashboard.internetcomputer.org/proposal/126094

This adds new fields to the management canister interface:

  - `reserved_cycles` to the result of `canister_status`.
  - `reserved_cycles_limit` to `canister_settings` and
    `definite_canister_settings`.

The corresponding fields are also added to the abstract state:

  - `reserved_balances`,
  - `reserved_balance_limits`.

Note that the naming matches the exiting naming of the main cycle
balance, which is `cycles` in the management canister and `balances` in
the abstract state.

A new unspecified function `cycles_to_reserve` models cycle reservation
for allocated resources depending on the old abstract state and the new
state of the canister (and its new allocation settings).

Since the reserved cycles also affect canister freezing, a new helper
function called `liquid_balance` is used to compute how many cycles
are available after taking the freezing limit and reserved cycles
into account.
  • Loading branch information
ulan committed Nov 28, 2023
1 parent 2f8f8e3 commit 104dc66
Show file tree
Hide file tree
Showing 2 changed files with 353 additions and 170 deletions.
3 changes: 3 additions & 0 deletions spec/_attachments/ic.did
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ type canister_settings = record {
compute_allocation : opt nat;
memory_allocation : opt nat;
freezing_threshold : opt nat;
reserved_cycles_limit : opt nat;
};

type definite_canister_settings = record {
controllers : vec principal;
compute_allocation : nat;
memory_allocation : nat;
freezing_threshold : nat;
reserved_cycles_limit : nat;
};

type change_origin = variant {
Expand Down Expand Up @@ -170,6 +172,7 @@ service ic : {
memory_size: nat;
cycles: nat;
idle_cycles_burned_per_day: nat;
reserved_cycles: nat;
});
canister_info : (record {
canister_id : canister_id;
Expand Down
Loading

0 comments on commit 104dc66

Please sign in to comment.