# Upgrade the Governance Canister to Commit f5a63fd
__Proposer__: daniel.wong at dfinity.org
__Source code__: [f5a63fd41933eee24ab3a6c71e43c67c1048e0db][new-commit]
[new-commit]: https://github.com/dfinity/ic/tree/f5a63fd41933eee24ab3a6c71e43c67c1048e0db
## New Commits
```
$ git log --format="%C(auto) %h %s" 0f96a6f4661f0d87bd9149a88846db9674360291..f5a63fd41933eee24ab3a6c71e43c67c1048e0db -- ./rs/nns/governance ./rs/sns/init
f5a63fd4193 feat(nns): Voting rewards are now in proportion to total *potential* voting power. (#2385)
1e2a626f4f2 feat(nns): Increase the neurons limit to 380K (#2603)
5ea5177ef08 feat(nns): Changed the default "voting power refreshed" timestamp to Sep 1. (#2570)
6d94310182a fix(nns): Fix ballot generation inefficiency (for stable neurons) (#2526)
0a3ab41db8d feat(nns): Support all neurons in stable memory behind feature flag (#2473)
b1c0f8cccb2 chore: upgrade rust_decimal and rust_decimal_macros (#2508)
```
## Current Version
__Current git hash__: 0f96a6f4661f0d87bd9149a88846db9674360291
__Current wasm hash__: 2ff71fadaed447883821a7b1d639e2ce1f5e3596e1c6a1f34af6682c6931f04f
## 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/f5a63fd41933eee24ab3a6c71e43c67c1048e0db/rs/nervous_system/docs/proposal_verification.md
### WASM Verification
See ["Building the code"][prereqs] for prerequisites.
[prereqs]: https://github.com/dfinity/ic/tree/f5a63fd41933eee24ab3a6c71e43c67c1048e0db/README.adoc#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 f5a63fd41933eee24ab3a6c71e43c67c1048e0db
# 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.
# Upgrade the Sns-wasm Canister to Commit f5a63fd
__Proposer__: daniel.wong at dfinity.org
__Source code__: [f5a63fd41933eee24ab3a6c71e43c67c1048e0db][new-commit]
[new-commit]: https://github.com/dfinity/ic/tree/f5a63fd41933eee24ab3a6c71e43c67c1048e0db
## New Commits
```
$ git log --format="%C(auto) %h %s" d265b130647f04aa25909ec1fbb8294ce0139d1c..f5a63fd41933eee24ab3a6c71e43c67c1048e0db -- ./rs/nns/sns-wasm ./rs/sns/init
3c22b95bec2 feat(sns): Automatically trigger upgrades when target_version is ahead of the current version (#2034)
3e0cf89b231 test(IDX): depend on the universal canister at run-time instead of at build-time (#2502)
123cf77ac90 feat(EXC-1727): Enable Canister Backtraces (#2403)
```
## Current Version
__Current git hash__: d265b130647f04aa25909ec1fbb8294ce0139d1c
__Current wasm hash__: 3760ee699c5b61fcec2fb5662924dbe3198062ae075e950f494f496185de232e
## 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/f5a63fd41933eee24ab3a6c71e43c67c1048e0db/rs/nervous_system/docs/proposal_verification.md
### WASM Verification
See ["Building the code"][prereqs] for prerequisites.
[prereqs]: https://github.com/dfinity/ic/tree/f5a63fd41933eee24ab3a6c71e43c67c1048e0db/README.adoc#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 f5a63fd41933eee24ab3a6c71e43c67c1048e0db
# 2. Build canisters.
./ci/container/build-ic.sh -c
# 3. Fingerprint the result.
sha256sum ./artifacts/canisters/sns-wasm-canister.wasm.gz
```
This should match `wasm_module_hash` field of this proposal.
f5a63fd4193 feat(nns):
Voting rewards are now in proportion to total potential voting power, using a distinctive potential_voting_power and deciding_voting_power.
The added test_distribute_rewards_with_total_potential_voting_power test is used to check the rewards distribution logic and ensures proportional rewards based on voting power. 1e2a626f4f2 feat(nns):
Done by setting MAX_NUMBER_OF_NEURONS to 380K that should last around 18 weeks acording to some analysis. 5ea5177ef08 feat(nns):
Part of the periodic confirmation instead of November 5th it is now set for pre-aging done by setting DEFAULT_VOTING_POWER_REFRESHED_TIMESTAMP_SECONDS to September first.
The rationale is explained in detail. 6d94310182a fix(nns):
Adds a fix for ballots generation when neurons are in stable memory. Done by adding with_active_neurons_iter_sections function to handle a collection of neurons segmented into different sections. 0a3ab41db8d feat(nns):
Added support for storing all neurons in stable memory behind the temporary use_stable_memory_for_all_neurons feature flag. b1c0f8cccb2 chore:
Version upgrade for both rust_decimal and rust_decimal_macros from 1.25.0 to 1.36.0.
I successfully built and verified the hash. All the commit descriptions match their code changes.
Hash Match: MATCH
Feedback: NONE
Proposer Check: MATCH
Commits
f5a63fd4193
Distinction between potential and deciding voting power, affecting how rewards are calculated and distributed based on actual voting participation.
The tests verify that rewards are distributed proportionally to neurons based on their actual voting participation, considering potential voting power and varying proposal reward weights.
1e2a626f4f2
Update the maximum number of neurons supported to 380_000.
5ea5177ef08
Fix DEFAULT_VOTING_POWER_REFRESHED_TIMESTAMP_SECONDS to more precisely midnight UTC.
6d94310182a
Optimized the loading of neuron data by allowing selective retrieval of neuron sections, potentially improving memory usage and performance. However, I don’t see any changes to ballot generation, maybe it is upstream of this change.
0a3ab41db8d
Add support for storing neuron data in stable memory as part of a feature flag. Enhanced benchmarking for neuron governance actions. compute_ballots_for_new_proposal now returns both the HashMap<u64, Ballot> and a u64 representing the potential_voting_power.
More chances to come as they have not fully resolve all operational challenges.
b1c0f8cccb2
Matches description of upgrade rust_decimal and rust_decimal_macros.
Reason:
Build successful and hashes match, commits look great and found no issues.
Review:
[f5a63fd4193]: Rewards are now proportional to the neuron’s deciding voting power relative to the total potential voting power of all participating neuron’s and makes the separation between deciding voting power and potential voting power. Tests were also created to verify this behavior.
[1e2a626f4f2]: Increases the MAX_NUMBER_OF_NEURONS from 350k to 380k. It was previously planned to make a larger scaling to 420k but since there is work being done to move all neurons to stable memory it was decided to make a more conservative change.
[5ea5177ef08]: Changed the default value of DEFAULT_VOTING_POWER_REFRESHED_TIMESTAMP_SECONDS that determines the default value for when a neuron’s voting power was changed. This comes as a sequence of past changes that intend to reduce the voting power of inactive neuron’s. This value was previously set to November 5th, 2024 but what reduced to September 1st, 2024 and the reason provided is that it’s intended that the neuron’s that haven’t taken any action start losing voting power sooner than 6 months which means that by reducing this value by 2 months will make them start losing in 4 months time.
[6d94310182a]: Optimizes ballot generation when neurons are in stable memory with a new function with_active_neurons_iter_sections that allows for specifying the sections of the neuron data to be retrieved instead of fetching all the data which includes unnecessary data for the operation improving performance.
[0a3ab41db8d]: Adds support to all neurons in stable memory behind temporary feature flags use_stable_memory_for_all_neurons and use_stable_following_index while maintaining support for heap memory. This is implemented across multiple files such as in metrics.rs where two distinct function are used depending on the state of the features flags.
[b1c0f8cccb2]:Update rust_decimal and rust_decimal_macros versions
No upgrade args. The install mode and canister id are correct.
Code changes
Upgrade rust_decimal from 1.25 to 1.36.0.
MAX_NUMBER_OF_NEURONS increased from 350k to 380k.
compute_ballots_for_new_proposal now also returns the potential total voting power, addressing cases where managing neurons or motion proposals have distinct logic.
More changes towards moving the neurons store to stable memory, under the is_active_neurons_in_stable_memory_enabled flag.
The default neuron refresh is now September 1st, 2024.
Fixed overflow handling in potential voting power calculations by ensuring the u64 maximum limit is checked before summation.
Introduced tests and conditional checks for migration-specific behaviors (e.g., ensuring active neurons in stable memory do not trigger validation errors prematurely).
Updated neuron storage operations to correctly toggle between heap and stable memory based on migration flags.
f5a63fd4193 Calculate voting rewards taking into account total potential voting power instead of the sum of current voting power of all neurons for proposals created after periodic confirmation is enabled.
1e2a626f4f2 Increase MAX_NUMBER_OF_NEURONS const from 350k to 380K.
5ea5177ef08 Modified DEFAULT_VOTING_POWER_REFRESHED_TIMESTAMP_SECONDS so that it starts at Sep 1st instead of Nov 5th.
6d94310182a Modified with_active_neurons_iter method and renamed it to with_active_neurons_iter_sections, the only difference is it now takes in an additional sections parameter, that is used when calling range_neurons_sections to determine which sections have to be included into neurons returned by the iterator, instead of defaulting to including all of them.
with_active_neurons_iter is now just a wrapper for with_active_neurons_iter_sections, to which it passes NeuronSections::all(), so that all sections are included and old behaviour is preserved. In create_ballots_for_standard_proposalNeuronSections::default() is passed instead, so that the neurons returned don’t contain not required data, saving up on memory and computation.
0a3ab41db8d Added 2 new feature flags: use_stable_memory_for_all_neurons and use_stable_following_index the former is used to toggle the use of stable memory for all neurons and the latter to determine whether the followee index for a neuron id on a certain topic should be fetched from the heap or from stable memory. Many methods in neuron store have been updated to behave differently depending on the value of these flags, effectively adding logic to add, update and fetch neurons from stable memory while still preserving the old behaviour.
b1c0f8cccb2 Bumped rust_decimal and rust_decimal_macros crates version.