-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(nns-governance): Delete *_voting_power fields from governance.proto. #3643
base: master
Are you sure you want to change the base?
refactor(nns-governance): Delete *_voting_power fields from governance.proto. #3643
Conversation
c05002c
to
bccde58
Compare
…overnance.proto. These are derived, and therefore, do not need to be stored in stable memory. They are part of the API though, so we do not remove them from governance.did.
…information is needed to perform this conversion. Specifically, in order to populate the deciding_voting_power field, VotingPowerEconomics is needed. Also deleted transcribing from *_voting_power fields in the other direction.
…ecause we deleted that in a recent commit. Resurrected `impl From<Neuron> for NeuronProto`, which replaces `into_proto`, which is no longer needed, because converting to NeuronProto no longer requires auxiliary data (used to calculate *_voting_power fields that have been deleted). Still need to implement convertion to API Neuron. That will be done in next commit. //rs/nns/governance builds 🤘
…fix affected tests, it was simply a matter of instead using pb::Neuron::from.
…ing *_voting_power fields from NNS governance.proto).
8fe714c
to
be7b682
Compare
…ng, which (again, IMHO) is per usual.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this pull request affects the behavior of any canister owned by
the Governance team, remember to update the corresponding
unreleased_changes.md file(s).
To acknowldge this reminder (and unblock the PR), dismiss this
code review by going to the bottom of the pull request page, and
supply one of the following reasons:
-
Done.
-
No canister behavior changes.
No canister behavior change. Just a refactor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Diff reading guide.
// we are using a circular buffer to store them. This solution is not ideal, but | ||
// we need to do a larger refactoring to use the correct API types instead of the internal | ||
// governance proto at this level. | ||
proto.recent_ballots = neuron.sorted_recent_ballots(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I may have forgotten to replace this... Not sure why this was done outside of conversion... That also seems like a mistake...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be added to the conversion, definitely. It wasn't added in the conversion b/c it didn't seem possible at the time without a lot of other work, though I forget the details.
created_timestamp_seconds, | ||
spawn_at_timestamp_seconds, | ||
followees, | ||
recent_ballots, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is all you need to do to get the ballots in the right order here:
let recent_ballots = self.sorted_recent_ballots();
let Neuron {
...
recent_ballots: _,
...
} = self;
Rationale/Motivation
These values are derived. Hence, they do not need to be and should not be stored.
Overview
Got rid of
into_proto
.Reintroduced
pb::Neuron::from
.Added
into_api
.Depending on the situation,
into_proto
calls were replaced with eitherpb::Neuron::from
orinto_api
. The difference is that the former is easier (requires less inputs), but the latter provides (deciding|potential)_voting_power.References
Closes NNS1-3500.