NNS Updates 2024-10-24

The Governance Team (formerly known as the NNS team) is proud to present several NNS canister upgrade proposals:

Bellow, is a copy of the summaries of of these proposals.

Governance

# Upgrade the Governance Canister to Commit 4bed17b

__Proposer__: daniel.wong at dfinity.org\
__Source Code__: [4bed17bfc82cddc5691743db6228992cdc2740f4][new-commit]

[new-commit]: https://github.com/dfinity/ic/tree/4bed17bfc82cddc5691743db6228992cdc2740f4

## New Commits

```
$ git log --format="%C(auto) %h %s" c494c2af8bfc70a6501448dc73bf806477388738..4bed17bfc82cddc5691743db6228992cdc2740f4 --  ./rs/nns/governance ./rs/sns/init
 4bed17bfc8 feat(nns): Neurons created with minimum dissolve delay (#1982)
 0a53517776 chore: upgrade core crates and use workspace version (#2111)
 7dfdc92abc fix(IDX): clean up TLA build (#2062)
 c226d1966d feat(nns): IC-1579 TLA-code link for claim_neuron (#2030)
 4bd8e1d843 refactor(nns): Improve range neurons performance for stable store (#2033)
 c4b3c8f7c8 fix: integer overflow in NNS tests in `is_inactive`  (#1984)
 3e274c7fbe chore(nns): Add a new feature flag for neuron migration (#1976)
```


## Current Version

- Current Git Hash: c494c2af8bfc70a6501448dc73bf806477388738
- Current Wasm Hash: 365411fcf8a925775e2111778ddda8f22ce828366c79b53b97ea78554dde381b


## Verification

See the general instructions on [how to verify] proposals like this. A "quick
start" guide is provided here.

[how to verify]: https://github.com/dfinity/ic/tree/4bed17bfc82cddc5691743db6228992cdc2740f4/rs/nervous_system/docs/proposal_verification.md


### WASM Verification

See ["Building the code"][prereqs] for prerequisites.

[prereqs]: https://github.com/dfinity/ic?tab=readme-ov-file#building-the-code

```
# 1. Get a copy of the code.
git clone git@github.com:dfinity/ic.git
cd ic
# Or, if you already have a copy of the ic repo,
git fetch
git checkout 4bed17bfc82cddc5691743db6228992cdc2740f4

# 2. Build canisters.
./ci/container/build-ic.sh -c

# 3. Fingerprint the result.
sha256sum ./artifacts/canisters/governance-canister.wasm.gz
```

This should match `wasm_module_hash` field of this proposal.

Genesis Token

# Upgrade the Genesis-token Canister to Commit 4bed17b

__Proposer__: daniel.wong at dfinity.org\
__Source Code__: [4bed17bfc82cddc5691743db6228992cdc2740f4][new-commit]

[new-commit]: https://github.com/dfinity/ic/tree/4bed17bfc82cddc5691743db6228992cdc2740f4

## New Commits

```
$ git log --format="%C(auto) %h %s" cf237434877b39d0a94fb5ef84b13ea576a225ac..4bed17bfc82cddc5691743db6228992cdc2740f4 --  ./rs/nns/gtc
 3bbabefb70 chore(Ledger-Suite): FI-1502 move icp and icrc ledger suites (#1682)
 f7791372e9 chore: remove old hyper and bump prost and tonic versions (#1597)
 09e7929d55 refactor(nervous-system): Remove ic-sns-governance and ic-sns-init's test_feature configurations (#1606)
 df1dbfc8a2 chore: Add file extension to globs (#1543)
 303b52a212 chore: Move GenesisTokenCanisterInitPayloadBuilder to rs/nns/test_utils (#1269)
```


## Current Version

- Current Git Hash: cf237434877b39d0a94fb5ef84b13ea576a225ac
- Current Wasm Hash: 31d91cbdfa6e1aae4cc4fee4f611e25f33922bd3d336f4cdc97d511e03b264a7


## Verification

See the general instructions on [how to verify] proposals like this. A "quick
start" guide is provided here.

[how to verify]: https://github.com/dfinity/ic/tree/4bed17bfc82cddc5691743db6228992cdc2740f4/rs/nervous_system/docs/proposal_verification.md


### WASM Verification

See ["Building the code"][prereqs] for prerequisites.

[prereqs]: https://github.com/dfinity/ic?tab=readme-ov-file#building-the-code

```
# 1. Get a copy of the code.
git clone git@github.com:dfinity/ic.git
cd ic
# Or, if you already have a copy of the ic repo,
git fetch
git checkout 4bed17bfc82cddc5691743db6228992cdc2740f4

# 2. Build canisters.
./ci/container/build-ic.sh -c

# 3. Fingerprint the result.
sha256sum ./artifacts/canisters/genesis-token-canister.wasm.gz
```

This should match `wasm_module_hash` field of this proposal.

Registry

# Upgrade the Registry Canister to Commit 4bed17b

__Proposer__: daniel.wong at dfinity.org\
__Source Code__: [4bed17bfc82cddc5691743db6228992cdc2740f4][new-commit]

[new-commit]: https://github.com/dfinity/ic/tree/4bed17bfc82cddc5691743db6228992cdc2740f4

## New Commits

```
$ git log --format="%C(auto) %h %s" 87343a880050ca72b1361138535211f5770dd52e..4bed17bfc82cddc5691743db6228992cdc2740f4 --  ./rs/registry/canister
 9fc5ab4e9e feat(registry): Add node_reward_type to NodeRecord (#1608)
 158f799bb0 chore: Remove __get_candid_interface_tmp_hack from nns and sns canisters (#1975)
 e2cb3d6389 chore: upgrade prost and tonic crates (#1738)
 f7791372e9 chore: remove old hyper and bump prost and tonic versions (#1597)
```


## Current Version

- Current Git Hash: 87343a880050ca72b1361138535211f5770dd52e
- Current Wasm Hash: 57c72469f01fd6ea8b5c5a962a1fed9b4ad550bbebdae38c29d5ad330c25c724


## Verification

See the general instructions on [how to verify] proposals like this. A "quick
start" guide is provided here.

[how to verify]: https://github.com/dfinity/ic/tree/4bed17bfc82cddc5691743db6228992cdc2740f4/rs/nervous_system/docs/proposal_verification.md


### WASM Verification

See ["Building the code"][prereqs] for prerequisites.

[prereqs]: https://github.com/dfinity/ic?tab=readme-ov-file#building-the-code

```
# 1. Get a copy of the code.
git clone git@github.com:dfinity/ic.git
cd ic
# Or, if you already have a copy of the ic repo,
git fetch
git checkout 4bed17bfc82cddc5691743db6228992cdc2740f4

# 2. Build canisters.
./ci/container/build-ic.sh -c

# 3. Fingerprint the result.
sha256sum ./artifacts/canisters/registry-canister.wasm.gz
```

This should match `wasm_module_hash` field of this proposal.
2 Likes

proposal - 133451

Hash: MATCH

Vote: ADOPT

Feedback: NONE

[4bed17bfc8]
New rate limits for neuron creation. Now there is a new field available_allowances that sets the number of neurons that can be created. Now most places where add_neuron is called it has with_rate_limits set to true.

[0a53517776]
Upgrade crates, such as paste from version 1.0.14 to 1.0.15, predicates from version 3.0.4 to 3.1.2, rsa from version 0.9.2 to 0.9.6, and subtle from version 2.5.0 to 2.6.1.

use workspace versions

[7dfdc92abc]
dynamically retrieves the TLA module path using an environment variable (TLA_MODULES)

[c226d1966d]
Adds TLA instrumentation to the account_balance method, logging both the request and response for balance queries, similar to what is already done for transfer_funds. This enhancement improves traceability by recording the account balance checks and their outcomes using formal TLA logging.

claim_neuron_desc creates a TLA update process for tracking a “Claim Neuron” operation

[4bd8e1d843]
get_range_boundaries helper and the optimized range_neurons improves the efficiency of iterating over neuron entries by using a combined range query on multiple maps

[c4b3c8f7c8]
Fix int overflow

[3e274c7fbe]
Add flag ACTIVE_NEURONS_IN_STABLE_MEMORY_ENABLED

proposal - 133452

Hash: MATCH

Vote: ADOPT

Feedback: NONE

[3bbabefb70]
refactor moving paths from rosetta-api to a new ledger_suite, affecting several Bazel build targets and dependencies for ledger-related modules.
Cargo.toml files across multiple components now reference the ledger_suite package for both ICP and ICRC1 ledgers. This restructuring consolidates ledger-related logic under the ledger_suite

[f7791372e9]
prost 0.12.2 to prost 0.13.2, as well as updates to tonic and tonic-build from 0.11.0 to 0.12.2.

[09e7929d55]
Remove --test_feature flags and restructuring dependencies in Bazel files.
governance canister now has an optional test_features_enabled flag, which is gated by an assertion to prevent test-only code from running in production

[df1dbfc8a2]
Update the Bazel build files by replacing file glob patterns from src/** to src/**/*.rs for Rust files and proto/** to proto/**/*.proto for protocol buffer files. This ensures that only .rs and .proto files are included in the build process

[303b52a212]
Old September commit.
removal of the init module from the GTC canister code, moving the GenesisTokenCanisterInitPayloadBuilder helper and related functions to a new gtc_helpers module under test_utils

proposal - 133453

Hash: MATCH

Vote: ADOPT

Feedback: NONE

[9fc5ab4e9e]
node_reward_type field

[158f799bb0]
removal of the deprecated __get_candid_interface_tmp_hack methods from multiple canister modules, including governance, SNS, and registry

[e2cb3d6389]
prost, regex, and tonic version bumps

replace tonic_build::compile with tonic_build::compile_protos for proto file compilation

enum references switched from Type::EnumName to Self::EnumName

[f7791372e9]
Duplicate

1 Like

Proposal 133451

Vote: Adopt

Build successful. Hashes match.

[4bed17bfc8] Sets the minimum neuron dissolve delay after a neuron is created to 1 week. Sets limits on creation of new neurons, initially 15 per hour but with some variations allowed.

[0a53517776] Version updates for various crates.

[7dfdc92abc] Test changes, specifically involving the Apalache model checker for TLA+.

[c226d1966d] Adds code for logging during the claim_neuron method using TLA+, and makes use of this in rs/nns/governance/src/governance.rs.

[4bd8e1d843] Adds fn range_neurons_performance, which serves to iterate over a range of neurons as part of benchmark testing with the intention of improving performance over the current method used.

[c4b3c8f7c8] Fixes a line in pub fn is_inactive that was causing an overflow error.

[3e274c7fbe] Adds new flag ACTIVE_NEURONS_IN_STABLE_MEMORY_ENABLED.

Proposal 133452

Vote: Adopt

Build successful. Hashes match.

[3bbabefb70] Adds a new directory rs/ledger_suite/ and moves ICP and ICRC1 ledger suites from rs/rosetta-api/ into their respective subdirectories within the new directory.

[f7791372e9] Version change for prost, tonic, hyper and related packages plus associated code changes.

[09e7929d55] Changes to several BUILD.bazel files in order to solve the issue of excessive numbers of crates having a --test_feature target.

[df1dbfc8a2] Changes srcs = glob(["src/**"]) to srcs = glob(["src/**/*.rs"]) in several BUILD.bazel files, the effect of which is to specify that the relevant packages should only use Rust files as source files in order to prevent building errors. Similarly, srcs = glob(["proto/**"]) is changed to srcs = glob(["proto/**/*.proto"]) in several places to specify .proto files only.

[303b52a212] Moves GenesisTokenCanisterInitPayloadBuilder struct and impl from rs/nns/gtc/src/ to rs/nns/test_utils/ + related code changes.

Proposal 133453

Vote: Adopt

Build successful. Hashes match.

[9fc5ab4e9e] Adds node_reward_type field to NodeRecord.

[158f799bb0] Removes deprecated method __get_candid_interface_tmp_hack from the relevant canisters.

[e2cb3d6389] Version changes for several packages.

[f7791372e9] Reviewed in 133452 above.

1 Like

Proposal 133451 Governance. Voted to adopt.


Hash and commits match.
4bed17bfc8 feat(nns):
Sets the minimum dissolve delay to 1 week for newly created neurons and ads rate limiting for neuron creation by setting :
MAX_SUSTAINED_NEURONS_PER_HOUR: Maximum number of neurons that can be created per hour to 15.
MINIMUM_SECONDS_BETWEEN_ALLOWANCE_INCREASE: Minimum seconds between increasing the neuron allowance to 4 minutes.
MAX_NEURON_CREATION_SPIKE: Maximum number of neurons that can be created in a short burst to 120.
0a53517776 chore:
upgrade core crates and use workspace version
7dfdc92abc fix(IDX):
Cleaner TLA tests for Bazel, specifically for APALACHE (that is a symbolic model checker for TLA+) binary and the TLA_module paths are now environment variables.
c226d1966d feat(nns):
Added the MODULE Claim_Neuron, while the claim_neuron_desc function generates a TLA+ specification for the “Claim Neuron” process.
4bd8e1d843 refactor(nns):
Improvemnts to the range_neurons function that now uses a range query on each map, and iterates all the ranges at the same time.
The range_neurons_performance function measures the performance of iterating over all neurons in neuron store using the range_neurons method. (in other words how quickly neuron IDs can be retrieved when iterating over the store).
c4b3c8f7c8 fix:
Fix using the method saturating_sub, which performs a subtraction that “saturates” at zero. So if now is less than 2 * 7 * ONE_DAY_SECONDS, the result will be zero instead of underflowing or becoming negative.
saturating_sub ensures that no underflow occurs and guarantees that the result is always non-negative, making it safer.
3e274c7fbe chore(nns):
Adds ACTIVE_NEURONS_IN_STABLE_MEMORY_ENABLED feature flag.

Proposal 133452 Genesis-token. Voted to adopt.


Hash and commits match.
All the commits are old (latest is 3 weeks old) and were previously reviewed before.

Proposal 133453 Registry. Voted to adopt.


Hash and commits match.

9fc5ab4e9e feat(registry):
Adds the node_reward_type to NodeRecord and to AddNodePayload.
The node_is_not_created_with_invalid_type test verifies that a node is not created with an invalid type.

1 Like

Upgrade the Governance Canister :white_check_mark:

Upgrade the Genesis-token :white_check_mark:

Upgrade the Registry Canister :white_check_mark:

Proposal 133451

Vote: ADOPT

Build successful and hashes match.

[4bed17bfc8]: Sets a dissolve delay for newly created neurons INITIAL_NEURON_DISSOLVE_DELAY = 1 week and a neuron creation limit MAX_SUSTAINED_NEURONS_PER_HOUR = 15 with some allowances.

[0a53517776]: Updates several crates

[7dfdc92abc]: Adds two new env variables TLA_APALACHE_BIN and TLA_MODULESthat point to the apalache-mc binary and TLA module paths respectively. Adds a new method get_tla_module_path that fetches the path of a TLA module based on its filename and the env variable TLA_MODULES.

[c226d1966d]: Introduces TLA+ macros like tla_log_request! and tla_log_response! to log the inputs and outputs of the account_balance call which is then used in rs/nns/governance/src/governance.rs.

[4bd8e1d843]: Introduces optimizations to improve the performance of traversing neurons in the StableBTreeMap. The key change lies in using range queries instead of iterating through each neuron individually and performing multiple lookups which resulted in a instruction count reduction of 40%.The range_neurons method was refactored to process the neurons in parallel from different data maps like hot_keys_map, recent_ballots_map… using a new helper function get_range_boundaries to extract the the start and end NeuronId from the provided range of each map and then uses collect_values_for_neuron_from_peekable_range to collect the data.

[c4b3c8f7c8]: Previously when setting max_dissolved_at_timestamp_seconds_to_be_inactive it triggered a integer overflow. This happened because now in tests is set to 50/60 seconds which when subtracting with 2 * 7 * ONE_DAY_SECONDS resulted in a negative value. The solution was to use saturating_sub to perform the subtraction that when the result is negative it returns 0.

[3e274c7fbe]: Adds a feature flag ACTIVE_NEURONS_IN_STABLE_MEMORY_ENABLED.

Proposal 133452

Vote: ADOPT

Build successful and hashes match.

[3bbabefb70]: Moves icp and icrc1 ledger suites from the rosetta-api/ subdirectory into the ledger_suite/ subdirectory as part of a restructure of the rosetta-api/.

[f7791372e9]: Removes hyper and bumps prost and tonic versions

[09e7929d55]: Removes the SNS Governance’s and SNS Init’s --test-feature target and moves this logic to the canister crate

[df1dbfc8a2]: Changes the globs used to select source files to be more specific by adding file extensions ( .rs for Rust or .proto for protocol files), ensuring only relevant files are included. This solves an issue where when building the compiler would complain about Vim .swp files.

[303b52a212]: Moves GenesisTokenCanisterInitPayloadBuilder from the gtc crate rs/nns/gtc/src/init.rs to a dedicated test utilities module under rs/nns/test_utils/src/gtc_helpers.rs

Proposal 133453

Vote: ADOPT

Build successful and hashes match.

[9fc5ab4e9e]: Adds node_reward_type field to AddNodePayload and NodeRecord

[158f799bb0]: Removes the deprecated method __get_candid_interface_tmp_hack.

[e2cb3d6389]: Updates the version of the prost and tonic crates

[f7791372e9]: Removes hyper and bumps prost and tonic versions

1 Like

Proposal 133451

Hashes and commits match. Adopted.

133451

[4bed17bfc8] Defined INITIAL_NEURON_DISSOLVE_DELAY constant and set it to 7 days, this is used as default value when a neuron is claimed. Furthermore add_neuron method was modified to take in an additional parameter which is used to enable rate limiting for neuron creation, a quota, i.e MAX_NEURON_CREATION_SPIKE, is initially set during canister upgrades, which is currently 120. Iif rate limiting is enabled and not enough allowance is left the method returns an error. The allowance is decreased by 1 when neuron is created and increased by 1 when it is deleted. Every 4 minutes the allowance is increased by 1 if it is lower than MAX_NEURON_CREATION_SPIKE.

[0a53517776] Bumped version for many dependencies and set them to use workspace version.

[7dfdc92abc] Improved setup for the TLA tests by providing apalache-mc binary and TLA module paths using environment variables.

[c226d1966d] Added TLA specification for claim_neuron and log account_balance using tla_log macros.

[4bd8e1d843] Optimized range_neurons method by using parallel range queries instead of doing individual key based lookups in each StableBTreeMap.

[c4b3c8f7c8] Use saturating sub when calculating max_dissolved_at_timestamp_seconds_to_be_inactive in is_inactive to prevent integer overflow.

[3e274c7fbe] Added ACTIVE_NEURONS_IN_STABLE_MEMORY_ENABLED feature flag, it is currently set to false.

Proposal 133452

Hashes match and all commits have been already reviewed as part of previous releases. Adopted.

133452

Proposal 133453

Hashes match and all commits have been already reviewed as part of previous releases. Adopted.
133453

1 Like