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

add new transition rejecting stop_canister calls #229

Merged
merged 14 commits into from
Nov 23, 2023
Merged
37 changes: 28 additions & 9 deletions spec/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4196,13 +4196,13 @@ The controllers of a canister can stop a canister. Stopping a canister goes thro

We encode this behavior via three (types of) transitions:

1. First, any `stop_canister` call sets the state of the canister to `Stopping`; we record in the status the origin (and cycles) of all `stop_canister` calls which arrive at the canister while it is stopping (or stopped).
1. First, any `stop_canister` call sets the state of the canister to `Stopping`; we record in the IC state the origin (and cycles) of all `stop_canister` calls which arrive at the canister while it is stopping (or stopped). Note that every such `stop_canister` call can be rejected by the system at any time (the canister stays stopping in this case), e.g., if the `stop_canister` call could not be responded for a long time.
mraszyk marked this conversation as resolved.
Show resolved Hide resolved

2. Next, when the canister has no open call contexts (so, in particular, all outstanding responses to the canister have been processed), the status of the canister is set to `Stopped`.

3. Finally, each pending `stop_canister` call (which are encoded in the status) is responded to, to indicate that the canister is stopped.

Conditions
Conditions

```html

Expand All @@ -4226,8 +4226,6 @@ S with

```

The next two transitions record any additional 'stop\_canister' requests that arrive at a stopping (or stopped) canister in its status.

Conditions

```html
Expand Down Expand Up @@ -4280,12 +4278,8 @@ S with

```

:::note

Sending a `stop_canister` message to an already stopped canister is acknowledged (i.e. responded with success), but is otherwise a no-op:

:::

Conditions

```html
Expand Down Expand Up @@ -4314,6 +4308,31 @@ S with

```

Pending `stop_canister` calls may be rejected by the system at any time (the canister stays stopping in this case):

Conditions

```html

S.canister_status[CanisterId] = Stopping (Older_origins · O · Younger_origins)
mraszyk marked this conversation as resolved.
Show resolved Hide resolved

```

State after

```html

S with
canister_status[CanisterId] = Stopping (Older_origins · Younger_origins)
messages = S.Messages ·
ResponseMessage {
origin = O
response = Reject (CANISTER_ERROR, 'Canister could not be stopped yet')
refunded_cycles = C
}

```

#### IC Management Canister: Starting a canister

The controllers of a canister can start a `stopped` canister. If the canister is already running, the command has no effect on the canister.
Expand Down Expand Up @@ -4377,7 +4396,7 @@ S with
} ·
[ ResponseMessage {
origin = O
response = Reject (CANISTER_REJECT, 'Canister has been restarted')
response = Reject (CANISTER_ERROR, 'Canister has been restarted')
refunded_cycles = C
}
| (O, C) ∈ Origins
Expand Down