-
Notifications
You must be signed in to change notification settings - Fork 339
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
Add Governor component #1180
base: main
Are you sure you want to change the base?
Add Governor component #1180
Conversation
…eleased-package-#1141
…emove-dual-dispatchers
…eat/remove-mocks-from-released-package-#1141
* feat: remove modules * fix: mock * fix: linter * fix: tests * fix: mock * feat: apply review suggestions
…om-released-package-#1141
…eat/remove-mocks-from-released-package-#1141
…eat/remove-mocks-from-released-package-#1141
…eat/remove-mocks-from-released-package-#1141
…contracts into feat/governance2-#294
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.
Great job, Eric! That wasn't an easy walkthrough, the feature is really complex. It's looking good, I left several comments
packages/governance/src/governor/extensions/governor_settings.cairo
Outdated
Show resolved
Hide resolved
packages/governance/src/governor/extensions/governor_votes_quorum_fraction.cairo
Outdated
Show resolved
Hide resolved
packages/governance/src/governor/extensions/governor_votes_quorum_fraction.cairo
Show resolved
Hide resolved
self | ||
.validate_state( | ||
proposal_id, array![ProposalState::Succeeded, ProposalState::Queued].span() | ||
); |
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.
It seems to be overkill for checking the state: we have to create an array and iterate through it. Maybe a more direct approach would be better
self | |
.validate_state( | |
proposal_id, array![ProposalState::Succeeded, ProposalState::Queued].span() | |
); | |
match self.state(proposal_id) { | |
ProposalState::Succeeded => (), | |
ProposalState::Queued => (), | |
_ => panic_with_felt252(Errors:: UNEXPECTED_PROPOSAL_STATE), |
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.
This is probably more efficient, but the validate_state helper can be used by users as well. We can refactor it into bitmap operations to avoid looping or matching, which should be even more efficient, and also usable by users. Let's keep the thread opened until the pending stuff is finished and I will work on that then.
packages/governance/src/governor/extensions/governor_counting_simple.cairo
Show resolved
Hide resolved
Co-authored-by: immrsd <[email protected]>
…contracts into feat/governance2-#294
…eat/governance2-#294
packages/governance/src/governor/extensions/governor_counting_simple.cairo
Outdated
Show resolved
Hide resolved
packages/governance/src/governor/extensions/governor_timelock_execution.cairo
Outdated
Show resolved
Hide resolved
packages/governance/src/governor/extensions/governor_votes_quorum_fraction.cairo
Outdated
Show resolved
Hide resolved
ref self: ComponentState<TContractState>, calls: Span<Call>, description_hash: felt252 | ||
) -> felt252 { | ||
let proposal_id = self._hash_proposal(calls, description_hash); | ||
self.validate_state(proposal_id, array![ProposalState::Pending].span()); |
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.
Is it possible to cancel a queued proposal?
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.
Shouldn't be possible, why?
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.
Fantastic job with the first iteration of tests! I left some comments
/// Temporary defined as a function since constant ByteArray is not supported yet. | ||
fn DEFAULT_PARAMS() -> Span<felt252>; |
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.
We should adjust the comment. Maybe test this with a non-empty span, WDYT?
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.
Comment adjusted. Will revisit tests after finishing tests for extensions.
…eat/governance2-#294
Fixes #294
PR Checklist