-
Notifications
You must be signed in to change notification settings - Fork 413
feat: Regional Community DAO #4333
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
base: master
Are you sure you want to change the base?
Conversation
🛠 PR Checks Summary🔴 Pending initial approval by a review team member, or review from tech-staff Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):🟢 Maintainers must be able to edit this pull request (more info) ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
@@ -139,6 +139,8 @@ func (dao *CommonDAO) Propose(creator std.Address, d ProposalDefinition) (*Propo | |||
return nil, ErrOverflow | |||
} | |||
|
|||
// doesn't check if the prop creator is a dao member? i assume it's left to the user of the p/ to define the behavior? |
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.
Yes, the idea is that devs should explicitly check it.
Following that idea it would be good that the fact is mentioned in the Propose()
method docs.
Documentation is something that should be improved 👍
Not checking that the creator address is a DAO member makes the proposing open to other use cases where devs might want to create proposals without enforcing membership.
// RenderableProposal makes sure that the proposal is renderable | ||
RenderableProposal interface { | ||
ProposalDefinition | ||
Render() string | ||
} |
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.
Could be simpler:
// RenderableProposal makes sure that the proposal is renderable | |
RenderableProposal interface { | |
ProposalDefinition | |
Render() string | |
} | |
// Renderable makes sure that the proposal is renderable. | |
Renderable interface { | |
Render() string | |
} |
This interface might be a good candidate to be defined in a p/nt/commondao/ui
package.
@@ -219,6 +225,8 @@ func (p Proposal) IsVoteChoiceValid(c VoteChoice) bool { | |||
return p.voteChoices.Has(string(c)) | |||
} | |||
|
|||
// add default prop render |
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.
Definitely a good feature to have, default render support for proposals, or DAOs so users can opt in.
It would be good to consider having a p/nt/commondao/ui
or p/nt/commondaoui
for render related features and default render logic.
At some point I tried to have render defaults so they could also be used in commondao
realm, but I found it was somehow limiting when adding links between types like DAO, proposal and vote for example, or when dealing with pagination because the rendered content was highly dependent on the realm render logic and the paths being resolved.
@@ -139,7 +139,7 @@ func FindMostVotedChoice(r ReadonlyVotingRecord) VoteChoice { | |||
|
|||
// SelectChoiceByAbsoluteMajority select the vote choice by absolute majority. | |||
// Vote choice is a majority when chosen by more than half of the votes. | |||
// Absolute majority considers abstentions when counting votes. | |||
// Absolute majority considers abstentions when counting votes. // what does the bool mean? quorum reached? prop passed? |
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.
In this case and the other majority check functions the second boolean result means that a majority was reached and voted for the same voting choice when result is true
otherwise it means that currently there is no majority winner. For SelectChoiceByAbsoluteMajority()
majority is met when more than 50% of the members voted the same choice.
There might be cases where devs would have to define their own majority check functions if the ones pre defined here won't work for their use case.
It might be good to add more majority check functions to cover more cases. A nice to have :)
Quorum can be checked using the IsQuorumReached()
function, there are also a couple of pre defined quorum constants to be used with that function. All defined within the proposal.gno
file.
for i := 0; i < len(ep.requestedBudget); i++ { | ||
coin := ep.requestedBudget[i] | ||
if treasuryCoins.AmountOf(coin.Denom) >= coin.Amount { | ||
panic("cannot pay out requested budget, too little in the treasury") | ||
} | ||
} |
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.
You could also move this into a Validate() error
method.
Validate is called before execution, if it fails then Execute()
is not called.
Just in case, have in mind that right now Validation()
and Execution()
errors don't make the transaction fail, so using panic
is the right move if you want the TX to fail and are expecting to change the state to eventually be able to successfully execute the proposal or if you plan to implement a way to change the proposal status yourself.
Right now, and before returning an error within the Execute()
method, it's important to make sure that the actual state changes are done after the current state is validated. Maybe changing commondao proposals to have an expiration date after which proposals could be invalidated would be a safer solution, so any execution error would panic by default 🤔. I'm not really sure about what would be the best approach. Thoughts on this would be helpful.
Otherwise returning an error in either of those will potentially lead to save any state changes done before returning the error and the proposal state will be updated to failed
.
I will give a though on how to improve this behavior because right now doesn't seem right.
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.
Let's add MustValidate
& MustExecute
?
Description
WIP