feat(nns): Known neurons are always public.#488
Merged
daniel-wong-dfinity-org merged 3 commits intoJul 22, 2024
Conversation
anchpop
approved these changes
Jul 19, 2024
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Jul 19, 2024
This just adds the ability to read the visibility of a neuron. There is not yet the ability to set it. Nor is this enforced. This follows the plan described [here](https://forum.dfinity.org/t/request-for-comments-api-changes-for-public-private-neurons/33360). Closes [NNS1-3072](https://dfinity.atlassian.net/browse/NNS1-3072). [Next PR >>](#488) [NNS1-3072]: https://dfinity.atlassian.net/browse/NNS1-3072?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
ea1dbec to
2a4611f
Compare
980f90a to
6952579
Compare
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Jul 22, 2024
This just adds the ability to read the visibility of a neuron. There is not yet the ability to set it. Nor is this enforced. This follows the plan described [here](https://forum.dfinity.org/t/request-for-comments-api-changes-for-public-private-neurons/33360). Closes [NNS1-3072](https://dfinity.atlassian.net/browse/NNS1-3072). [Next PR >>](#488) [NNS1-3072]: https://dfinity.atlassian.net/browse/NNS1-3072?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
… step towards the end of neuron fetching in NeuronStore.
fffad6a to
c22e85f
Compare
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Jul 23, 2024
Setting the visibility of known neurons is not allowed, [per the plan](https://forum.dfinity.org/t/request-for-comments-api-changes-for-public-private-neurons/33360#known-neurons-are-always-public-6). As described [here](https://forum.dfinity.org/t/request-for-comments-api-changes-for-public-private-neurons/33360#reading-and-writing-visibility-4). **Entrained change**: Added implementations of Command::from(struct) and Operation::from(struct). If desired, this could be split off pretty easily into another PR, because these changes are in their own commit (thanks to git rebase -i). Closes [NNS1-3073](https://dfinity.atlassian.net/browse/NNS1-3073). Closes [NNS1-3082](https://dfinity.atlassian.net/browse/NNS1-3082). [<< Previous PR](#488) [NNS1-3073]: https://dfinity.atlassian.net/browse/NNS1-3073?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ [NNS1-3082]: https://dfinity.atlassian.net/browse/NNS1-3082?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Jul 26, 2024
…s. (#589) [Per the plan](https://forum.dfinity.org/t/request-for-comments-api-changes-for-public-private-neurons/33360). The upshot is that people can now read public neurons. # Entrained Changes(s) Fixed a bug from a [recent change of mine](#488) where neuron normalization was not applied 😬 Renamed list_neurons_by_principal to list_neurons in order to exactly match the Candid method name. Also, changed its &PrincipalId parameter to be of type PrincipalId, since that type is Copy. Overhauled the implementation of (what is now called) Governance::list_neurons. This is the main thing I was touching anyway, but the change could have been smaller. Added NeuronStore::can_principal_vote_on_proposals_that_target_neuron. Refactored NeuronStore::get_full_neuron to use can_principal_vote_on_proposals_that_target_neuron. # References Closes [NNS1-3077](https://dfinity.atlassian.net/browse/NNS1-3077) [<< Previous PR](#517) [NNS1-3077]: https://dfinity.atlassian.net/browse/NNS1-3077?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is done by adding a normalization step towards the end of fetching a neuron from NeuronStore. More precisely, normalized(neuron) returns a possibly modified copy of neuron where the visibility field is set to Some(Visibility::Public) when the known_neuron_data field is Some(...).
This approach requires no data migration (and no extra storage). One drawback though is that when visibility = null in a stored neuron, it means something different depending on whether the neuron is known or not: known + visibility=null means public; whereas not known + visibility=null means private. This seems ok, because in our design, we intuitively have two rules:
Closes NNS1-3074.
<< Previous PR | Next PR >>