-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[framework] Partial governance voting support for delegation pool #8090
Conversation
cc2247a
to
9a17ffd
Compare
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
@movekevin Think more about moving
TBH I think moving |
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 correct to me high-level wise, just some minor comments and one important high-level comment: Let's create a separate feature flag for enabling delegation voting
aptos-move/framework/aptos-framework/sources/aptos_governance.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/delegation_pool.move
Outdated
Show resolved
Hide resolved
0741772
to
bb950c7
Compare
Fix a comment Add additional feature flag checking in delegation_pool.move
Remove unnecessary prover spec pragma
f386908
to
3f9e51e
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
✅ Forge suite
|
) * Support partial voting in aptos-governance * Support delegation partial governance voting * Add comments * Refactor naming. Fix a edge case when a delegation pool voter votes before enabling partial governance voting on this delegation pool. Add DelegateVotingPowerEvent. Fix typos. * Remove redundant condition checking * Fix naming Fix comments Remove get_latest_delegator_vote_delegation and get_latest_vote_delegation Wrap logic of updating governance records into functions Fix a bug of governance records when withdrawing inactive shares Fix get_remaining_voting_power in aptos_governance when proposals expire * Add TODOs * Fix lint * Fix struct annotation * Fix a typo * Fix a bug about voting power Fix a comment Add additional feature flag checking in delegation_pool.move * Fix specs * Remove unnecessary move prover change * Fix enable_partial_governance_voting condition in initialize_delegation_pool * Remove redundant borrow Remove unnecessary prover spec pragma * Use smart_table instead of table in aptos_governance --------- Co-authored-by: Teng Zhang <[email protected]>
…tos-labs#8090) * Support partial voting in aptos-governance * Support delegation partial governance voting * Add comments * Refactor naming. Fix a edge case when a delegation pool voter votes before enabling partial governance voting on this delegation pool. Add DelegateVotingPowerEvent. Fix typos. * Remove redundant condition checking * Fix naming Fix comments Remove get_latest_delegator_vote_delegation and get_latest_vote_delegation Wrap logic of updating governance records into functions Fix a bug of governance records when withdrawing inactive shares Fix get_remaining_voting_power in aptos_governance when proposals expire * Add TODOs * Fix lint * Fix struct annotation * Fix a typo * Fix a bug about voting power Fix a comment Add additional feature flag checking in delegation_pool.move * Fix specs * Remove unnecessary move prover change * Fix enable_partial_governance_voting condition in initialize_delegation_pool * Remove redundant borrow Remove unnecessary prover spec pragma * Use smart_table instead of table in aptos_governance --------- Co-authored-by: Teng Zhang <[email protected]>
…tos-labs#8090) * Support partial voting in aptos-governance * Support delegation partial governance voting * Add comments * Refactor naming. Fix a edge case when a delegation pool voter votes before enabling partial governance voting on this delegation pool. Add DelegateVotingPowerEvent. Fix typos. * Remove redundant condition checking * Fix naming Fix comments Remove get_latest_delegator_vote_delegation and get_latest_vote_delegation Wrap logic of updating governance records into functions Fix a bug of governance records when withdrawing inactive shares Fix get_remaining_voting_power in aptos_governance when proposals expire * Add TODOs * Fix lint * Fix struct annotation * Fix a typo * Fix a bug about voting power Fix a comment Add additional feature flag checking in delegation_pool.move * Fix specs * Remove unnecessary move prover change * Fix enable_partial_governance_voting condition in initialize_delegation_pool * Remove redundant borrow Remove unnecessary prover spec pragma * Use smart_table instead of table in aptos_governance --------- Co-authored-by: Teng Zhang <[email protected]>
) * Support partial voting in aptos-governance * Support delegation partial governance voting * Add comments * Refactor naming. Fix a edge case when a delegation pool voter votes before enabling partial governance voting on this delegation pool. Add DelegateVotingPowerEvent. Fix typos. * Remove redundant condition checking * Fix naming Fix comments Remove get_latest_delegator_vote_delegation and get_latest_vote_delegation Wrap logic of updating governance records into functions Fix a bug of governance records when withdrawing inactive shares Fix get_remaining_voting_power in aptos_governance when proposals expire * Add TODOs * Fix lint * Fix struct annotation * Fix a typo * Fix a bug about voting power Fix a comment Add additional feature flag checking in delegation_pool.move * Fix specs * Remove unnecessary move prover change * Fix enable_partial_governance_voting condition in initialize_delegation_pool * Remove redundant borrow Remove unnecessary prover spec pragma * Use smart_table instead of table in aptos_governance --------- Co-authored-by: Teng Zhang <[email protected]>
Description
Delegators in a delegation pool can attend Aptos governance.
For a delegator:
For a voter:
Details
Pre-knowledge
High-level ideas
active shares pool
+ its coins inpending inactive shares pool
.active shares pool
andpending inactive shares pool
need to be tracked. Whenever a delegator's voting power changes, its voter's voting power is also updated.Let's say delegator D's voter is X at this lockup period and its voter will be changed to Y at the next lockup period. To summarize impacts on voter due to A's operations:
🤖 Generated by Copilot at 4d58991
This pull request implements partial governance voting, a feature that allows voters to vote with a fraction of their delegated stake, on the Aptos blockchain. It adds and modifies spec functions, transaction payload functions, and entry function variants in the
aptos_governance
andaptos_framework_sdk_builder
modules. It also adds a new moduleaptos_governance
and a new functionincrease_lockup
to thee2e-move-tests
folder, and creates a new modulevote
with several test cases and scripts to test the partial voting feature.Test Plan
Unit testing
delegation_pool.move: % Move Coverage: 93.49