NNS Update, Nov 29, 2024

The Governance team submitted the following proposals. DFINITY plans to vote on these proposals the following Monday.

NNS Governance

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

SNS-W

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

1 Like

Proposal #134340

Vote: Adopted
Reason: Builds fine and the hash matches., as do all listed commits.

Review:

to be added …
7a20299a24 feat(IC-1579): TLA instrumentation for merge_neuron (#2341)

3120812461 feat(nns): Added (potential|deciding)_voting_power fields to API. (#2880)

ccaa87049c test(nns): Daughter neurons should have fresh voting power. (#2859)

2facd31e58 feat(nns): Added dedicated API for refreshing voting power. (#2856)

063075d9e0 perf(nns): Update canbench_results.yml for NNS Governance and turn on test (#2841)

d212868d8d fix(nns): Fix incorrectly modified line from NeuronSections PR (#2842)

e133fb6401 refactor(nns): Refactor neuron spawn timestamp check to Neuron::ready_to_spawn (#2812)

b3b8f9a2a4 refactor(governance): NeuronSections no longer implements default. (#2470)

9f168dd6e0 chore(nns): Fix benchmark test (#2813)

ae295d0216 fix(nns): Improve performance of stable neuron recent ballots recording (#2697)

Proposal 134340

Vote: ADOPT

Reason:
Build successful and hashes match, commits look great and match the description. Found no issues.

Review:

[7a20299a24]: Adds TLA instrumentation to merge_neurons in NNS Governance. Introduces state logging, links the Rust implementation to the TLA model and made Apalache checks more efficient through parallel execution.

[3120812461]: Adds two new fields deciding_voting_power and potential_voting_power to the NNS Governance API.

[ccaa87049c]: Child neurons should have fresh voting power and since this logic was already in place by coincidence, the commit adds asserts to verify the behavior.

[2facd31e58]: Adds a RefreshVotingPower to ManageNeuron API. Th logic of this command is in the fucntion refresh_voting_power in Governance that first checks if the caller is authorized before refreshing the voting power. This will be used to compare the neuron’s deciding_voting_power to it’s potential_voting_power.

[063075d9e0]: The command bazel test //rs/nns/governance:governance_canbench_test is supposed to run the new added test governance-canbench but when looking at the source file it only has an empty main function. This commit only activates the test but no logic is implemented so it won’t run.

[d212868d8d]: Solved a confusion in the previous commit where one NeuronSections::default() was replaced by NeuronSections::ALL instead of NeuronSections::NONE.

[e133fb6401]: Refactors the code inside the list_ready_to_spawn_neuron_ids function for neuron spawn timestamp check since this was uncecessarily complex. Instead this is replaced with the new Neuron function ready_to_spawn.

[b3b8f9a2a4]: Adds two new constants to NeuronSections, NeuronSections::ALL (replacing NeuronsSections::all function) and NeuronSections::NONE. NeuronSections::NONE also replaces every instance of NeuronSections::default() since this was considered ambiguous and many may think that the default may be ALL.

[9f168dd6e0]: Fixes a bug because the field recent_ballots_next_entry_index was not being explicitly initialized for neurons in the benchmark tests triggering the migration logic by setting neuron.recent_ballots_next_entry_index = Some(0); in the make_neuron function.

[ae295d0216]: Improves the performance of neuron recent ballots recording. This is achieved to several change such as implementing a circular buffer recent_ballots mechanism to store recent ballots with the new field recent_ballots_next_entry_index keeping track of where to insert the next ballot. Previously this mechanism was mimicked by inserting the newest ballot at the beginning of the Vector and then pop of the vector the farthest ballot if self.recent_ballots.len() > MAX_NEURON_RECENT_BALLOTS but this requires shifting the position of all others one step forward which is more computationally expensive. Another change was to move the recent ballots to stable memory.

1 Like

Proposal 134340

Vote: ADOPT

Reason: Build is successful and both code changes and hashes match.
134340

7a20299a24 Added TLA instrumentation for merge_neuron

3120812461 Added deciding_voting_power and potential_voting_power fields to Neuron and NeuronInfo structs

ccaa87049c Modified tests to ensure when a neuron is split or disbursed, the newly created neuron has created_timestamp_seconds and voting_power_refreshed_timestamp_second set to current timestamp.

2facd31e58 Added RefreshVotingPower variant to ManageNeuron::Command and ManageNeuronResponse::Command enums, these are used to add support for refreshing neuron voting power in the neuron management API. Since refresh_voting_power is used in the public api and therefore can now be called from the “outside”, a check has been added to ensure the caller has permission to vote with the neuron and return an error if they don’t.

063075d9e0 Same as description.

d212868d8d b3b8f9a2a4 mistakenly replaced NeuronSections::default() with ALL in create_ballots_for_standard_proposal. This commit fixes that.

e133fb6401 Added ready_to_spawn helper method to Neuron struct, which returns true if the neuron is ready to spawn a new neuron and use it to simplify logic of list_ready_to_spawn_neuron_ids. Added 2 new unit tests, test_ready_to_spawn to ensure the new method works as expected and test_ready_to_unstake_maturity to verify proper functioning of existing ready_to_unstake_maturity method.

b3b8f9a2a4 Made NeuronSections usage more explicit by getting rid of its default method, which could be interpreted as enabling all sections. Instead 2 constants: NONE and ALL have been added and put in place of default and all methods.

9f168dd6e0 Properly set recent_ballots_next_entry_index in make_neuron to avoid costly ballots migration.

ae295d0216 Added optional recent_ballots_next_entry_index field to Neuron struct, this is used to optimize insertion of new ballots by using recent_ballots vector as a circular buffer. At each insertion the index is incremented by 1 and when it reaches MAX_NEURON_RECENT_BALLOTS limit it is reset to 0. This allows to avoid costly shifting of all elements in the vector every time a ballot is added. Since initially this field will be empty, when register_recent_neuron_ballo is called, it is initialized to the current size of the ballot vector if it’s below the limit, otherwise it is set to 0. In get_neuron_info a new method is used to retrieve the ballots called sorted_recent_ballots, if no recent_ballots_next_entry_index is found then it means the neuron is still using the old vector representation, so it simply clones the vector and returns it. Otherwise a vector slice is created starting from the index up until the end of the vector, then another slice, which starts from the beginning of the vector and ends at index - 1, is concatenated and finally the resulting vector is reversed and returned.

1 Like