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 module connecting with AccessManager #4523

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5fd9a98
add back GovernorTimelock
frangio Aug 8, 2023
1498539
WIP
frangio Aug 8, 2023
36dc884
rename GovernorTimelock -> GovernorTimelockAccess
frangio Aug 8, 2023
2d2b087
make base delay modifiable
frangio Aug 10, 2023
221261f
remove available since
frangio Aug 10, 2023
499a2a1
use relay to call the target contract
frangio Aug 10, 2023
d5ca8be
fix warning
frangio Aug 10, 2023
7ed7c1c
Update contracts/governance/extensions/GovernorTimelockAccess.sol
frangio Aug 11, 2023
bf9fdf9
fix initial set of base delay
frangio Aug 11, 2023
5ced769
rename maxDelay -> neededDelay
frangio Aug 11, 2023
3820637
address guardian cancellation risk
frangio Aug 11, 2023
31e20a1
use single manager per governor
frangio Aug 12, 2023
56ed5a4
add nonces
frangio Aug 12, 2023
6ca99ef
make _hashOperation private
frangio Aug 15, 2023
e34c093
add docs for nonce
frangio Aug 15, 2023
40adbb7
typo
frangio Aug 15, 2023
2c41d41
Update contracts/governance/extensions/GovernorTimelockAccess.sol
frangio Aug 15, 2023
1446af0
Update contracts/governance/extensions/GovernorTimelockAccess.sol
frangio Aug 15, 2023
bc2bfa5
Update contracts/access/manager/AccessManager.sol
frangio Aug 15, 2023
af274b1
add proposalNeedsQueuing
frangio Aug 15, 2023
bac912e
remove timepoint from executed and canceled events
frangio Aug 15, 2023
a1cbc83
add tests for proposalNeedsQueuing
frangio Aug 15, 2023
ebd6dcd
Apply suggestions from code review
frangio Aug 15, 2023
6902ad7
fix docs
frangio Aug 15, 2023
e96474c
remove unnecessary override
frangio Aug 15, 2023
452c65e
remove _authorityOverride
frangio Aug 15, 2023
f7b3b93
add missing docs
frangio Aug 15, 2023
3b47038
remove unused imports
frangio Aug 15, 2023
8d5e734
typo
frangio Aug 15, 2023
4f89411
lint
frangio Aug 15, 2023
40eea48
add basic tests
frangio Aug 16, 2023
0604f4d
add custom error
frangio Aug 16, 2023
16519fe
lint
frangio Aug 16, 2023
85148a9
make variable private
frangio Aug 16, 2023
a36618b
add changeset
frangio Aug 16, 2023
b37ed30
do not delete executionPlan
frangio Aug 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions contracts/governance/Governor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,13 @@ abstract contract Governor is Context, ERC165, EIP712, Nonces, IGovernor, IERC72
return _proposals[proposalId].eta;
}

/**
* @dev See {IGovernor-proposalEta}.
*/
frangio marked this conversation as resolved.
Show resolved Hide resolved
function proposalNeedsQueuing(uint256) public view virtual returns (bool) {
return false;
}

/**
* @dev Reverts if the `msg.sender` is not the executor. In case the executor is not this contract
* itself, the function reverts if `msg.data` is not whitelisted as a result of an {execute}
Expand Down
6 changes: 6 additions & 0 deletions contracts/governance/IGovernor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ interface IGovernor is IERC165, IERC6372 {
*/
function proposalEta(uint256 proposalId) external view returns (uint256);

/**
* @notice module:core
* @dev Whether a proposal needs to be queued before execution.
*/
function proposalNeedsQueuing(uint256 proposalId) external view returns (bool);

/**
* @notice module:user-config
* @dev Delay, between the proposal is created and the vote starts. The unit this duration is expressed in depends
Expand Down
8 changes: 8 additions & 0 deletions contracts/governance/extensions/GovernorTimelockAccess.sol
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ abstract contract GovernorTimelockAccess is Governor {
return (delay, indirect);
}

/**
* @dev See {IGovernor-proposalEta}.
*/
frangio marked this conversation as resolved.
Show resolved Hide resolved
function proposalNeedsQueuing(uint256 proposalId) public view virtual override returns (bool) {
return _executionPlan[proposalId].delay > 0;
}


/**
* @dev See {IGovernor-propose}
*/
Expand Down
7 changes: 7 additions & 0 deletions contracts/governance/extensions/GovernorTimelockCompound.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ abstract contract GovernorTimelockCompound is Governor {
return address(_timelock);
}

/**
* @dev See {IGovernor-proposalEta}.
*/
function proposalNeedsQueuing(uint256) public view virtual override returns (bool) {
return true;
}

/**
* @dev Function to queue a proposal to the timelock.
*/
Expand Down
7 changes: 7 additions & 0 deletions contracts/governance/extensions/GovernorTimelockControl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ abstract contract GovernorTimelockControl is Governor {
return address(_timelock);
}

/**
* @dev See {IGovernor-proposalEta}.
*/
function proposalNeedsQueuing(uint256) public view virtual override returns (bool) {
return true;
}

/**
* @dev Function to queue a proposal to the timelock.
*/
Expand Down
4 changes: 4 additions & 0 deletions contracts/mocks/docs/governance/MyGovernor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ contract MyGovernor is
return super.state(proposalId);
}

function proposalNeedsQueuing(uint256 proposalId) public view virtual override(Governor, GovernorTimelockControl) returns (bool) {
return super.proposalNeedsQueuing(proposalId);
}

function _queueOperations(
uint256 proposalId,
address[] memory targets,
Expand Down
4 changes: 4 additions & 0 deletions contracts/mocks/governance/GovernorStorageMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ abstract contract GovernorStorageMock is
return super.proposalThreshold();
}

function proposalNeedsQueuing(uint256 proposalId) public view virtual override(Governor, GovernorTimelockControl) returns (bool) {
return super.proposalNeedsQueuing(proposalId);
}

function _propose(
address[] memory targets,
uint256[] memory values,
Expand Down
4 changes: 4 additions & 0 deletions contracts/mocks/governance/GovernorTimelockCompoundMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ abstract contract GovernorTimelockCompoundMock is
return super.proposalThreshold();
}

function proposalNeedsQueuing(uint256 proposalId) public view virtual override(Governor, GovernorTimelockCompound) returns (bool) {
return super.proposalNeedsQueuing(proposalId);
}

function _queueOperations(
uint256 proposalId,
address[] memory targets,
Expand Down
4 changes: 4 additions & 0 deletions contracts/mocks/governance/GovernorTimelockControlMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ abstract contract GovernorTimelockControlMock is
return super.proposalThreshold();
}

function proposalNeedsQueuing(uint256 proposalId) public view virtual override(Governor, GovernorTimelockControl) returns (bool) {
return super.proposalNeedsQueuing(proposalId);
}

function _queueOperations(
uint256 proposalId,
address[] memory targets,
Expand Down
1 change: 1 addition & 0 deletions test/utils/introspection/SupportsInterface.behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const INTERFACES = {
'proposalDeadline(uint256)',
'proposalProposer(uint256)',
'proposalEta(uint256)',
'proposalNeedsQueuing(uint256)',
'votingDelay()',
'votingPeriod()',
'quorum(uint256)',
Expand Down