Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Marco Walz <[email protected]>
  • Loading branch information
jessiemongeon1 and marc0olo authored Dec 3, 2024
1 parent d53ef70 commit 4fde97c
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/developer-docs/smart-contracts/maintain/delete.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { GlossaryTooltip } from "/src/components/Tooltip/GlossaryTooltip";

If you want to permanently delete a specific <GlossaryTooltip>canister</GlossaryTooltip> or all canisters for a project, you can use the [`dfx canister delete <canister-name>`](/docs/current/developer-docs/developer-tools/cli-tools/cli-reference/dfx-canister#dfx-canister-delete) command.

Deleting a canister removes the canister identifier, code, and state. Before you can delete a canister, you must first stop the canister using [`dfx canister stop <canister-name>`](/docs/current/developer-docs/developer-tools/cli-tools/cli-reference/dfx-canister#dfx-canister-stop) to clear any pending message requests or replies.
Deleting a canister permanently removes its code and state. This action cannot be undone and once the canister is deleted, its ID cannot be reused. Before you can delete a canister, you must first stop the canister using [`dfx canister stop <canister-name>`](/docs/current/developer-docs/developer-tools/cli-tools/cli-reference/dfx-canister#dfx-canister-stop) to clear any pending message requests or replies.

## Errors related to canister deletion

Expand Down
4 changes: 2 additions & 2 deletions docs/developer-docs/smart-contracts/maintain/logs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ dfx canister update-settings <canister-name> --log-visibility public

Canister log allow lists enable principals that are not controllers of the canister to view the logs without the logs being public. Log allow lists are supported in `dfx` versions `0.24.2` and newer.

To add a principal to the canister's log allow list, update the canister's settings with the flags:
To specify principals in the canister's log allow list, update the canister's settings with the flags:

- `dfx canister update-settings <canister-name> --set-log-viewer <principal-id>`: Set a single principal as a log viewer.

Expand All @@ -59,4 +59,4 @@ You can also configure a principal as a log viewer when you create a canister:
dfx canister create <canister-name> --log-viewer <principal-id>
```

Or, you can set the `canisters[].initialization_values.log_visibility.allowed_viewers` configuration setting in your project's `dfx.json` file.
Or, you can set the `canisters[].initialization_values.log_visibility.allowed_viewers` configuration setting in your project's `dfx.json` file to set the canister log allowed viewers upon canister creation.
2 changes: 1 addition & 1 deletion docs/developer-docs/smart-contracts/maintain/recovery.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { GlossaryTooltip } from "/src/components/Tooltip/GlossaryTooltip";

## Overview

A <GlossaryTooltip>canister</GlossaryTooltip> is managed and maintained by **controllers**. A controller can be a single developer identity, a list of developer identities, or another canister. If a canister does not have a controller, it cannot be upgraded, deleted, or otherwise maintained. If access to a canister's controller(s) is lost, the canister cannot be deleted, upgraded or further maintained. If a canister's code traps with an unrecoverable error and cannot be upgraded, the canister can potentially be recovered using canister snapshots or an NNS proposal.
A <GlossaryTooltip>canister</GlossaryTooltip> is managed and maintained by **controllers**. A controller can be a single developer identity, a list of developer identities, or another canister. If a canister does not have a controller, it cannot be upgraded, deleted, or otherwise maintained. This also applies if access to all canister's controllers identities are lost. If a canister's code traps with an unrecoverable error and cannot be upgraded, the canister can potentially be recovered using canister snapshots or an NNS proposal.

## Canister snapshots

Expand Down
2 changes: 1 addition & 1 deletion docs/developer-docs/smart-contracts/maintain/settings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Currently, there are seven canister setting fields:
There are two ways to read the settings of a canister:

1. Command line: [`dfx canister status <canister-name>`](/docs/current/developer-docs/developer-tools/cli-tools/cli-reference/dfx-canister#dfx-canister-status). Note that this command returns the canister's settings, along with other canister status information.
2. Programmatically: Call the [`canister_status`](https://internetcomputer.org/docs/current/references/ic-interface-spec) endpoint of the IC management canister. The canister's settings will be in the `settings` field of the result.
2. Programmatically: Call the [`canister_status`](/docs/current/references/ic-interface-spec) endpoint of the IC management canister. The canister's settings will be in the `settings` field of the result.

### Command line

Expand Down
2 changes: 1 addition & 1 deletion docs/developer-docs/smart-contracts/maintain/storage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ By default, a canister's stable memory is empty. The maximum storage limit for s

## Storage cost

Storage cost is calculated based on the GiB of storage used by a canister per second, costing `127_000` <GlossaryTooltip>cycles</GlossaryTooltip> on a 13-node subnet and `127_000 / 13 * 34` cycles on a subnet with 34 nodes. In USD, this works out to about $0.431 and $1.127, respectively, for storing 1 GiB of data for a 30-day month. The cost is the same whether the canister is using heap memory, stable memory, or both.
Storage cost is calculated based on the GiB of storage used by a canister per second, costing `127_000` <GlossaryTooltip>cycles</GlossaryTooltip> on a 13-node subnet and `127_000 / 13 * 34` cycles on a subnet with 34 nodes. In USD, this works out to about $0.43 and $1.13, respectively, for storing 1 GiB of data for a 30-day month. The cost is the same whether the canister is using heap memory, stable memory, or both.

[Learn more about storage costs](/docs/current/developer-docs/gas-cost).

Expand Down
2 changes: 1 addition & 1 deletion docs/developer-docs/smart-contracts/maintain/trapping.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ If a canister traps during a message execution, two things happen:
Using pre_ and post_upgrade hooks is discouraged. It is error-prone and can render a canister unusable. Per best practices, using these methods should be avoided if possible.
:::

Special care should be taken when writing a `pre_upgrade` hook for your canister which will run during an upgrade against the current canister's Wasm module. If the [`pre_upgrade`](/docs/current/references/ic-interface-spec#system-api-upgrades) hook traps, then the canister upgrade will fail. This is extremely important as it can mean your canister can be permanently unrecoverable.
Special care should be taken when writing a `pre_upgrade` hook for your canister which will run during an upgrade against the current canister's Wasm module. If the [`pre_upgrade`](/docs/current/references/ic-interface-spec#system-api-upgrades) hook traps, then the canister upgrade will fail. This is extremely important as it means your canister can be permanently unrecoverable.

In order to avoid unexpected surprises, it is strongly recommended that your canisters use stable memory directly, which removes the need for having a `pre_upgrade` hook in the first place.

Expand Down

0 comments on commit 4fde97c

Please sign in to comment.