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

Initial code for Radworks upgraded Governor #2

Merged

Conversation

jferas
Copy link
Contributor

@jferas jferas commented Nov 2, 2023

Added Bravo/OZ style governor with needed timelock interface changes

Copy link
Contributor

@wildmolasses wildmolasses left a comment

Choose a reason for hiding this comment

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

looks good @jferas! i gave you a bunch of nits, for you to do as you will with. Cheers.

src/RadworksGovernor.sol Outdated Show resolved Hide resolved
src/RadworksGovernor.sol Outdated Show resolved Hide resolved
src/RadworksGovernor.sol Show resolved Hide resolved
src/RadworksGovernor.sol Show resolved Hide resolved
src/RadworksGovernor.sol Outdated Show resolved Hide resolved
src/lib/GovernorTimelockCompound.sol Outdated Show resolved Hide resolved
src/lib/GovernorTimelockCompound.sol Outdated Show resolved Hide resolved
src/lib/GovernorTimelockCompound.sol Outdated Show resolved Hide resolved
src/interfaces/IRadworksTimelock.sol Outdated Show resolved Hide resolved
src/RadworksGovernor.sol Outdated Show resolved Hide resolved
@jferas jferas requested a review from alexkeating November 6, 2023 15:57
Copy link

@alexkeating alexkeating left a comment

Choose a reason for hiding this comment

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

Looks good, I left some comments and questions

@@ -0,0 +1,218 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.18;

Choose a reason for hiding this comment

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

I think this can bumped to ^0.8.20 as that is what we have as the version in the Counters.sol

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done: a62f287

/// @inheritdoc IGovernor
// solhint-disable-next-line func-name-mixedcase
function COUNTING_MODE() public pure override returns (string memory) {
return "support=bravo&quorum=bravo";

Choose a reason for hiding this comment

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

I think this needs to conform to https://eips.ethereum.org/EIPS/eip-6372. Do we need to override the inherited method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to override COUNTING_MODE here as it is required by Governor who RadworksGovernor inherits from

contract RadworksGovernor is
Governor,
GovernorVotesComp,
RadworksGovernorTimelockCompound,

Choose a reason for hiding this comment

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

I think we can use the stock GovernorTimelockCompound. We used a custom Timelock contract for PoolTogether because their GRACE_PERIOD method was called gracePeriod. But, for Radicle it seems to be compatible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Indeed.. I guess I missed that both were present: c7f59d4

require(
_proposalVotersWeightCast[proposalId][account] == 0,
"Radworks Governor: vote would exceed weight"
);

Choose a reason for hiding this comment

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

Nit: I think using an error type is more gas efficient

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done: 857551e

}

/// @inheritdoc Governor
function _quorumReached(uint256 proposalId) internal view virtual override returns (bool) {

Choose a reason for hiding this comment

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

Why does this and the _voteSucceeded need to be overrided?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe it needs to be as RadworksGovernor inherits from Governor

// This RadworksGovernorTimelockCompound has been modified from the OZ GovernorTimelockCompound to
// support a Radworks Timelock which does not conform to Governor Alpha Timelock. If Radworks
// decides to change the Timelock in the future then it must conform to the Radworks Timelock
// interface.

Choose a reason for hiding this comment

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

Is the existing timelock acceptable enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree: c7f59d4

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, ok! so radworks timelock is simply the default? this simplifies things 👍

Choose a reason for hiding this comment

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

Yes, it is different, but it doesn't conflict in the same way as the poolTogether timelock did.

Copy link

github-actions bot commented Nov 7, 2023

Coverage after merging feature/add-governor into 11-02-chore_install_OZ_contracts_library will be

7.41%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   Counter.sol100%100%100%100%
   RadworksGovernor.sol0%0%0%0%104, 109, 111, 116, 118, 129, 129, 129–130, 132, 134, 134, 134–136, 136, 136–138, 138, 138–139, 141, 155, 166, 177, 184, 195–196, 206, 217, 87, 93

Copy link
Contributor

@wildmolasses wildmolasses left a comment

Choose a reason for hiding this comment

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

lgtm

@jferas jferas changed the base branch from 11-02-chore_install_OZ_contracts_library to main November 9, 2023 21:01
@jferas jferas changed the base branch from main to 11-02-chore_install_OZ_contracts_library November 9, 2023 21:05
@jferas jferas merged commit ba760da into 11-02-chore_install_OZ_contracts_library Nov 9, 2023
6 checks passed
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.

3 participants