-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Governance: vote options #2544
Governance: vote options #2544
Conversation
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.
Really great work! No big showstoppers as far as I can see, just one question about backwards compatibility and some nits
@@ -1207,6 +1217,25 @@ impl GovernanceProgramTest { | |||
.await | |||
} | |||
|
|||
#[allow(dead_code)] |
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.
not specific to this line, but I'm having a tough time seeing -- are you running any basic tests creating / voting on v1 structs? If you'll have outstanding v1 proposals still being voted on, it'll be good as a sanity check to add these if they aren't there.
I'm mainly bringing this up because I'm worried about the PDA change on the proposal instruction account for existing v1 proposals.
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.
Still working on these tests. What is the best approach here? Load the old program, create accounts and then upgrade or we can somehow fake the V1 accounts?
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 was thinking you'd fake the v1 accounts by hand, but that might be extremely annoying in your case... anyway, not a show-stopper by any means
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
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!
Summary
This change adds support for multi option voting and survey only proposals. The following voting systems were implemented:
Each proposal can either be executable or non executable (survey only). The executable proposals can have instructions associated with different options and always have
Deny
option which allows to down vote the proposal and prevent execution of the instructions.When multiple choice executable proposal is voted on each option is considered individually and can either success or fail and hence only a subset of successful options can be executed after vote on the proposal ends.
Implementation details
The voting system was generalised to multi option voting and the legacy Yes/No vote system is now implemented as a specific use case:
SingleChoice
vote withYes
only option andDeny (No)
option.Legacy V1 accounts are fully supported through in/out serialisation transformations.
Out of the scope
Support for 1) Weighted voting 2) Quadratic voting and 3) Ranked voting was added to the account structures but not implemented in this PR