Repository navigation
refactor(contract): store parameter votes hash-only via Votes - #4870
SimonRastikian wants to merge 3 commits into
Conversation
…tes' into 2825-store-parameter-votes-hash-only
Pull request overviewThis PR finishes the hash-only vote storage for governance parameter proposals tracked in #2825. I verified the acceptance semantics are unchanged: every voter for a given hash was authenticated against that proposal's participant set at vote time, so Changes:
Reviewed changesPer-file summary
FindingsBlocking (must fix before merge):
Non-blocking (nits, follow-ups, suggestions):
|
| .expect("usize should never fail to convert to u64 on wasm32"); | ||
| let accepted = n_votes == n_proposed; | ||
| if accepted { | ||
| self.clear(); |
There was a problem hiding this comment.
What is the reason for moving this here? I think this should be handled by the caller (like we currently do).
If this is the right place, then the function name should be reflecting that we not only vote, but also clear in case of success.
| keyset: (&self.keyset).into_dto_type(), | ||
| parameters: (&self.parameters).into_dto_type(), | ||
| // TODO(#2825): reporting dropped ahead of the switch to hash-only votes. | ||
| // Pending votes are stored hash-only, so their proposals can't be reported. |
There was a problem hiding this comment.
This comment doesn't add much value, please remove it.
| /// Tracks votes for proposed threshold parameters; each account can maintain one vote. | ||
| /// Only proposal hashes are stored; callers pass the full proposal with each vote so | ||
| /// acceptance can be checked against its participant set. |
There was a problem hiding this comment.
nit: Can you make this comment more concise?
| /// Pending votes for new parameters; storage-backed, so kept outside [`ProtocolContractState`]. | ||
| /// Emptied on every protocol state transition except a resharing cancellation. |
There was a problem hiding this comment.
nit: This comment risks getting stale. Please avoid paraphrasing the code.
|
|
||
| /// Votes for threshold parameter changes. | ||
| /// Votes for threshold parameter changes. Always empty: the contract stores only proposal | ||
| /// hashes and no longer reports pending votes. Kept for wire compatibility. |
There was a problem hiding this comment.
I have two questions:
- What depends on it, i.e. why do we need to keep it and can't remove it?
- How can we view current votes
edit: ah, I think this gets changed in #4872
This is part of the issue
In this PR:
GovernanceThresholdParametersVotesis a wrapper aroundVotes<AuthenticatedAccountId>along withParametersVotesByVoterandParametersVotesByProposalprocess_new_parameters_proposalnow returnsvotes.vote(...)directlyNotice we don't migrate any existing parameter votes between contract updates. We simply drop the existing votes.