-
Notifications
You must be signed in to change notification settings - Fork 346
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
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
Continue to review full report in Codecov by Sentry.
|
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.
Looking good, Eric! Phew...the governor is a big addition. Sorry for the 32423402340923 comments 😅
Co-authored-by: Andrew Fleming <[email protected]>
Co-authored-by: Andrew Fleming <[email protected]>
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. |
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.
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!
|
||
pub trait IGovernor2 { | ||
fn name() -> felt252; | ||
|
||
fn version() -> felt252; | ||
|
||
fn COUNTING_MODE() -> ByteArray; | ||
|
||
fn hash_proposal(calls: Span<Call>, description_hash: felt252) -> felt252; | ||
|
||
// fn state(proposal_id: felt252) -> ProposalState; | ||
|
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.
:)
|
||
/// Interface for a contract that implements the ERC-6372 standard. | ||
#[starknet::interface] | ||
pub trait IERC6372<TState> { | ||
/// Clock used for flagging checkpoints. | ||
/// Can be overridden to implement timestamp based checkpoints (and voting). | ||
/// Can be overridden to implement block number based checkpoints (and voting). |
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.
/// Can be overridden to implement block number based checkpoints (and voting). |
I think we can remove this sentence because it's just the interface and not the impl
/// Returns the token that voting power is sourced from. | ||
/// Returns the timelock controller address. | ||
fn timelock(self: @ComponentState<TContractState>) -> ContractAddress { |
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.
👍
[[GovernorComponent-cast_vote_with_reason_and_params_by_sig]] | ||
==== `[.contract-item-name]#++cast_vote_with_reason_and_params_by_sig++#++(proposal_id: felt252, support: u8, voter: ContractAddress, reason: ByteArray, params: Span<felt252>, signature: Span<felt252>) → u256++` [.item-kind]#external# | ||
|
||
Cast a vote with a `reason` and additional serialized `params` using the `voter`'s |
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.
Cast a vote with a `reason` and additional serialized `params` using the `voter`'s | |
Cast a vote with a `reason` and additional serialized `params` using the ``voter``'s |
[[IGovernor-cast_vote_with_reason_and_params_by_sig]] | ||
==== `[.contract-item-name]#++cast_vote_with_reason_and_params_by_sig++#++(proposal_id: felt252, support: u8, voter: ContractAddress, reason: ByteArray, params: Span<felt252>, signature: Span<felt252>) → u256++` [.item-kind]#external# | ||
|
||
Cast a vote on a proposal with a reason and additional encoded parameters using the voter's signature. |
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.
Cast a vote on a proposal with a reason and additional encoded parameters using the voter's signature. | |
Cast a vote on a proposal with a reason and additional encoded parameters using the ``voter``'s signature. |
To match the component description
[[GovernorTimelockExecutionComponent-timelock_salt]] | ||
==== `[.contract-item-name]#++timelock_salt++#++(self: @ContractState, description_hash: felt252) → felt252++` [.item-kind]#internal# | ||
|
||
Computes the `TimelockController` operation salt. |
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.
Computes the `TimelockController` operation salt. | |
Computes the `TimelockController` operation salt as the XOR of the governor address and `description_hash`. |
In case users are curious 🤷♂️
Fixes #1234