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 documentation #1235

Merged
merged 9 commits into from
Dec 3, 2024
Merged

Conversation

ericnordelo
Copy link
Member

Fixes #1234

Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.26%. Comparing base (493a4d1) to head (43b4170).
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1235   +/-   ##
=======================================
  Coverage   92.26%   92.26%           
=======================================
  Files          59       59           
  Lines        1811     1811           
=======================================
  Hits         1671     1671           
  Misses        140      140           
Files with missing lines Coverage Δ
.../governor/extensions/governor_core_execution.cairo 77.77% <ø> (ø)
...governor/extensions/governor_counting_simple.cairo 100.00% <ø> (ø)
...ce/src/governor/extensions/governor_settings.cairo 100.00% <ø> (ø)
...ernor/extensions/governor_timelock_execution.cairo 98.41% <ø> (ø)
...or/extensions/governor_votes_quorum_fraction.cairo 96.87% <ø> (ø)
packages/governance/src/governor/governor.cairo 92.50% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 493a4d1...43b4170. Read the comment docs.

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.

Looking good, Eric! Phew...the governor is a big addition. Sorry for the 32423402340923 comments 😅

docs/modules/ROOT/pages/governance/governor.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/governance/governor.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/governance/governor.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/governance/governor.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/governance/governor.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/api/governance.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/api/governance.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/api/governance.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/api/governance.adoc Show resolved Hide resolved
docs/modules/ROOT/pages/api/governance.adoc Show resolved Hide resolved
ericnordelo and others added 4 commits November 29, 2024 13:08
Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>
Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>
@ericnordelo
Copy link
Member Author

I added the right interface id cc @andrew-fleming. All I needed to do was to add the empty type to the enum variants in ProposalState, and the src5_rs did the trick without issues. I double checked that every Extended Function Selector looked right.

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.

Improvements look great! I left a few more suggestions and comments, but I think we're super close. And nice work with src5 workaround solution!

packages/governance/src/governor/interface.cairo Outdated Show resolved Hide resolved
packages/governance/src/governor/interface.cairo Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/api/governance.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/api/governance.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/api/governance.adoc Outdated Show resolved Hide resolved
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.

Well done!

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.

LGTM!

@@ -54,6 +54,8 @@ pub mod GovernorVotesQuorumFractionComponent {
+Drop<TContractState>
> of GovernorComponent::GovernorQuorumTrait<TContractState> {
/// See `GovernorComponent::GovernorQuorumTrait::quorum`.
///
/// Returns a percentage of the votes token total supply at a given timepoint in the past.
Copy link
Collaborator

@immrsd immrsd Dec 3, 2024

Choose a reason for hiding this comment

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

Sounds a bit difficult to understand, maybe it could be rephrased

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree, tried to rephrase it a bit.

percentage of the total supply at the block when a proposal’s voting power is retrieved. This requires an initializer
parameter to set the percentage besides the votes token address. Most Governors nowadays use 4%, so we will initialize
the module with parameter 40 since the quorum denominator is 1000 for precision (this indicates the percentage,
resulting in 4%).
Copy link
Collaborator

Choose a reason for hiding this comment

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

This part could be rephrased to improve clarity:

"Most Governors nowadays use a quorum of 4%. Since the quorum denominator is 1000 for precision, we initialize the module with a numerator of 40, resulting in a 4% quorum (40/1000 = 0.04 or 4%)"

Copy link
Member Author

Choose a reason for hiding this comment

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

Better indeed.

@ericnordelo ericnordelo merged commit 0676415 into OpenZeppelin:main Dec 3, 2024
2 of 3 checks passed
@ericnordelo ericnordelo deleted the docs/governor branch December 3, 2024 13:37
ericnordelo added a commit that referenced this pull request Dec 4, 2024
* docs: document main component

* feat: add extensions API References

* Update docs/modules/ROOT/pages/governance/governor.adoc

Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>

* Update docs/modules/ROOT/pages/governance/governor.adoc

Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>

* feat: apply review updates

* feat: add interface id

* feat: apply review updates

* feat: add interface

* feat: apply review updates

---------

Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>
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.

Add Governor documentation
3 participants