-
Notifications
You must be signed in to change notification settings - Fork 2
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
Allowing to unvote without having to switch to a new vote #218
base: main
Are you sure you want to change the base?
Allowing to unvote without having to switch to a new vote #218
Conversation
4837a83
to
9a3ac9d
Compare
contracts/hydro/src/vote.rs
Outdated
|
||
let lock_entry = &lock_entries[&lock_id]; | ||
|
||
// If user didn't yet vote with the given lock in the given round and tranche, check |
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.
The comment seems outdated now. We don't have an explicit check anymore for whether the user has voted in the given round/tranche; if they already voted in this round, then implicitly their old VOTING_ALLOWED_ROUND was erased during process_unvotes
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.
Looks good to me. Since this is a bit of a bigger change that touches core logic, I want to get a second set of eyes on it, so not approving yet.
Thanks a ton for the contribution!
The merge conflicts with main are quite small (regenerating checksums/artifacts/schema and organizing changelog). I don't think I have permission to fix them (since the PR is from the moonkitt-lab hydro repo), could you take care of it? The only thing to pay attention to is that the merge automatically tried to put your changelog entry into 3.0.0 (it should stay in unreleased). Thanks! |
PR is fixed and should resolve conflicts. The changelog entry is kept in |
Description
Closes: #211
This PR introduces a new
Unvote
message allowing users to remove their votes from specific tranches by specifying lock IDs. Additionally, it includes a significant refactor of the voting system to optimize storage operations and improve code organization.Key Changes
Unvote
message type for explicit vote removalvote.rs
moduleImplementation Details
New Files
vote.rs
module containing:process_votes
: Handles new vote application, once any previous vote has been removedprocess_unvotes
: Manages vote removalvalidate_proposals_and_locks_for_voting
: Input validation prior to votingMajor Improvements
Optimized Vote Processing
Enhanced Storage Operations
add_many_validator_shares_to_proposal
function supporting both positive and negative changesSCALED_PROPOSAL_SHARES_MAP
andPROPOSAL_TOTAL_MAP
Code Organization
Minor Changes
While maintaining full functional compatibility, there are minor changes to the
Vote
message's response attributes: locks re-voting for the same proposal are now included in thelocks_skipped
attribute rather than thelocks_voted
attribute.Testing Notes
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
.changelog
make compile
and included content of the artifacts directory into the PRmake schema
and included generated files into the PR