Skip to content
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

Merged
merged 105 commits into from
Nov 20, 2024
Merged

Conversation

ericnordelo
Copy link
Member

@ericnordelo ericnordelo commented Oct 11, 2024

Fixes #294

PR Checklist

  • Tests
  • Documentation
  • Added entry to CHANGELOG.md
  • Tried the feature on a public network

…eat/remove-mocks-from-released-package-#1141
* feat: remove modules

* fix: mock

* fix: linter

* fix: tests

* fix: mock

* feat: apply review suggestions
…eat/remove-mocks-from-released-package-#1141
…eat/remove-mocks-from-released-package-#1141
…eat/remove-mocks-from-released-package-#1141
@ericnordelo ericnordelo marked this pull request as ready for review November 15, 2024 00:05
Copy link
Collaborator

@andrew-fleming andrew-fleming left a 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

packages/governance/src/governor/governor.cairo Outdated Show resolved Hide resolved
packages/governance/src/governor/governor.cairo Outdated Show resolved Hide resolved
packages/utils/src/bytearray.cairo Outdated Show resolved Hide resolved
packages/utils/src/bytearray.cairo Outdated Show resolved Hide resolved
packages/governance/src/tests/governor/test_governor.cairo Outdated Show resolved Hide resolved
packages/governance/src/tests/governor/test_governor.cairo Outdated Show resolved Hide resolved
packages/governance/src/governor/governor.cairo Outdated Show resolved Hide resolved
Comment on lines 125 to 126
/// Temporary defined as a function since constant ByteArray is not supported yet.
fn DEFAULT_PARAMS() -> Span<felt252>;
Copy link
Collaborator

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?

Copy link
Member Author

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.

Copy link
Collaborator

@immrsd immrsd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple of non-blocking comments. Good job, LGTM!

.execute_batch(calls, 0, this_component.timelock_salt(description_hash));

// Cleanup
this_component.Governor_timelock_ids.write(proposal_id, 0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be a bit more secure to update the state prior to making an external call, guards against reentrancy

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that there are no checks associated with the value for this particular case. Even if we don't update the value it should be ok, since the state of the timelock proposal should be correct one even if we don't remove the id. Also, the target of the execute may want to verify the state of the proposal at some point, and the id being accessible can help with that.

Comment on lines 111 to 112
/// NOTE: This function does not emit an event if the new voting delay is the same as the
/// old one.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be more clear if we move the note here and in the similar functions to the end of the function description

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep the "Emit event" section at the end for consistency, but let's put the note right on top.

@ericnordelo ericnordelo merged commit f0edfaa into OpenZeppelin:main Nov 20, 2024
8 checks passed
@ericnordelo ericnordelo deleted the feat/governance2-#294 branch November 20, 2024 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Governance Contracts
3 participants