SNS Updates: Nov 8, 2024 - Making Swap a proper SNS canister

The Governance Team submitted the following proposal to Publish a new version of SNS Governance. DFINITY plans to vote on these proposals the following Monday.

The main new feature in this release is SNS-driven upgrades for Swap. For more details, see Making Swap a proper SNS canister.

https://dashboard.internetcomputer.org/proposal/134044

# Publish SNS Governance WASM Built at Commit 0f96a6f

__Proposer__: arshavir.ter.gabrielyan at dfinity.org

__Source code__: [0f96a6f4661f0d87bd9149a88846db9674360291][new-commit]

[new-commit]: https://github.com/dfinity/ic/tree/0f96a6f4661f0d87bd9149a88846db9674360291


## New Commits

```
$ git log --format="%C(auto) %h %s" aa91ecacdf3824e193e21b70e0127e8d3edab51a..0f96a6f4661f0d87bd9149a88846db9674360291 --  ./rs/sns/governance
 43d2c5359e feat(sns): Serve SNS upgrade journal over Http (#2489)
 45fc54bdb1 refactor(sns): Separate UpgradeInProgress and PendingVersion (#2469)
 cb77e9eb8b refactor(sns): err_if_another_upgrade_is_in_progress refactor (#2453)
 7d5b9981ec feat(sns): SNS Governance upgrades its Swap (#2300)
 cc80f846a1 feat(sns): Populate upgrade journal (#2321)
 7632f62563 fix(sns): Remove accidentally-included timer type definitions (#2387)
 0346088900 feat: Linear map. (#2338)
 e6b41509e3 feat(sns): Add the upgrade_journal to the get_upgrade_journal SNS-Gov endpoint (#2169)
 c0b2ec6580 chore(sns): Rename sale → swap in various places. (#2267)
```


## Wasm 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/0f96a6f4661f0d87bd9149a88846db9674360291/rs/nervous_system/docs/proposal_verification.md

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

[prereqs]: https://github.com/dfinity/ic/tree/0f96a6f4661f0d87bd9149a88846db9674360291/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 0f96a6f4661f0d87bd9149a88846db9674360291

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

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

This should match `wasm` field of this proposal.

proposal - 134043

Vote: ADOPT

Reason:

Wasm Verification Match and Success. Nice changes related to periodic confirmation. Didn’t find anything wrong with the introduced changes.

Hash Match: MATCH

Feedback: NONE

Proposer Check: MATCH

Overall Summary:

Lots of good changes on this one. The implementation of periodic confirmation is good to see. More changes related to this feature are probably pending.

Commits Summary

4a7913a300
Introduces a feature-gated approach for stable neuron support, keeping it behind a flag to control its availability during ongoing development and migration preparation.

67e2ff4a50
This commit is the continuation in implementing the punishment for sleeper neurons. The proposal formalized neuron activity requirements for maintaining voting power in the ICP governance system. Neurons must actively participate by voting, setting, or confirming following settings every six months, or their voting power will be reduced to zero after seven months of inactivity. This design aims to ensure that inactive, “sleeper” neurons do not skew voting results or reward distributions, thus keeping decision-making aligned with active participants.

This change introduces a new field, total_potential_voting_power, to track the maximum voting power available if all neurons remain “refreshed.” This serves as a baseline for distributing voting rewards proportionally based on the actual voting power exercised.

7927c348c7
Another commit related to periodic confirmation.

The deciding_voting_power function calculates a neuron’s voting power by adjusting its potential voting power based on how long it has been since the neuron last refreshed its voting power; this adjustment is applied as a linearly decreasing factor over a six-to-seven-month period, reducing voting power to zero at seven months of inactivity if enabled.

Currently under a flag in testing mode.

52e5c5a9c5
Cleaning up unused code.

b588a681ef
Cleaning up unused code.

f2b767f156
Conditional mechanism in DissolveStateAndAge ensures that neurons are correctly categorized as either actively dissolving or inactive, with validation checks applied before adding or modifying neuron states. The NeuronStore now enforces data integrity by performing these validations, preventing issues with malformed dissolution states, fixing the bug that made certain neurons inaccessible.

ce465b8bd9
New fields to the neuron initialization process, specifically dissolve_delay_s and maturity_e8s_equivalent, which help in defining neuron characteristics like dissolve delay and maturity more explicitly.

a52f966827
The refresh_voting_power function is applied whenever a neuron interacts with proposals, ensuring only active participation retains voting influence. It starts on 2024-11-05.

de1e62b8c6
voting_power_refreshed_timestamp_seconds, across multiple neuron-related structures, with the purpose of tracking when a neuron last refreshed its voting power. Future implementation pending.

c0b2ec6580
Renaming and restructuring code references from “sale” to "swap”. These changes are made in many files. Matches commit description.