Skip to content

feat(nns): Known neurons are always public.#488

Merged
daniel-wong-dfinity-org merged 3 commits into
masterfrom
known-neurons-are-always-public-daniel-wong
Jul 22, 2024
Merged

feat(nns): Known neurons are always public.#488
daniel-wong-dfinity-org merged 3 commits into
masterfrom
known-neurons-are-always-public-daniel-wong

Conversation

@daniel-wong-dfinity-org
Copy link
Copy Markdown
Contributor

@daniel-wong-dfinity-org daniel-wong-dfinity-org commented Jul 19, 2024

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:

  1. By default, neurons are private.
  2. Known neurons are always public.

Closes NNS1-3074.

<< Previous PR | Next PR >>

@github-actions github-actions Bot added the feat label Jul 19, 2024
@daniel-wong-dfinity-org daniel-wong-dfinity-org changed the base branch from master to neuron-visibility-daniel-wong July 19, 2024 18:11
@daniel-wong-dfinity-org daniel-wong-dfinity-org marked this pull request as ready for review July 19, 2024 18:19
@daniel-wong-dfinity-org daniel-wong-dfinity-org requested a review from a team as a code owner July 19, 2024 18:19
github-merge-queue Bot pushed a commit that referenced this pull request Jul 19, 2024
@daniel-wong-dfinity-org daniel-wong-dfinity-org force-pushed the known-neurons-are-always-public-daniel-wong branch from ea1dbec to 2a4611f Compare July 22, 2024 09:39
@daniel-wong-dfinity-org daniel-wong-dfinity-org force-pushed the neuron-visibility-daniel-wong branch from 980f90a to 6952579 Compare July 22, 2024 10:18
github-merge-queue Bot pushed a commit that referenced this pull request Jul 22, 2024
Base automatically changed from neuron-visibility-daniel-wong to master July 22, 2024 11:31
@daniel-wong-dfinity-org daniel-wong-dfinity-org force-pushed the known-neurons-are-always-public-daniel-wong branch from fffad6a to c22e85f Compare July 22, 2024 11:38
@daniel-wong-dfinity-org daniel-wong-dfinity-org added this pull request to the merge queue Jul 22, 2024
Merged via the queue into master with commit 163f1b0 Jul 22, 2024
@daniel-wong-dfinity-org daniel-wong-dfinity-org deleted the known-neurons-are-always-public-daniel-wong branch July 22, 2024 13:21
github-merge-queue Bot pushed a commit that referenced this pull request Jul 23, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants