-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request from GHSA-5h3x-9wvq-w4m2
Co-authored-by: Francisco <[email protected]> Co-authored-by: Ernesto García <[email protected]> (cherry picked from commit d947432)
- Loading branch information
Showing
4 changed files
with
231 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': patch | ||
--- | ||
|
||
`Governor`: Add a mechanism to restrict the address of the proposer using a suffix in the description. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.19; | ||
|
||
import "forge-std/Test.sol"; | ||
import "../../contracts/utils/Strings.sol"; | ||
import "../../contracts/governance/Governor.sol"; | ||
|
||
contract GovernorInternalTest is Test, Governor { | ||
constructor() Governor("") {} | ||
|
||
function testValidDescriptionForProposer(string memory description, address proposer, bool includeProposer) public { | ||
if (includeProposer) { | ||
description = string.concat(description, "#proposer=", Strings.toHexString(proposer)); | ||
} | ||
assertTrue(_isValidDescriptionForProposer(proposer, description)); | ||
} | ||
|
||
function testInvalidDescriptionForProposer( | ||
string memory description, | ||
address commitProposer, | ||
address actualProposer | ||
) public { | ||
vm.assume(commitProposer != actualProposer); | ||
description = string.concat(description, "#proposer=", Strings.toHexString(commitProposer)); | ||
assertFalse(_isValidDescriptionForProposer(actualProposer, description)); | ||
} | ||
|
||
// We don't need to truly implement implement the missing functions because we are just testing | ||
// internal helpers. | ||
|
||
function clock() public pure override returns (uint48) {} | ||
|
||
// solhint-disable-next-line func-name-mixedcase | ||
function CLOCK_MODE() public pure override returns (string memory) {} | ||
|
||
// solhint-disable-next-line func-name-mixedcase | ||
function COUNTING_MODE() public pure virtual override returns (string memory) {} | ||
|
||
function votingDelay() public pure virtual override returns (uint256) {} | ||
|
||
function votingPeriod() public pure virtual override returns (uint256) {} | ||
|
||
function quorum(uint256) public pure virtual override returns (uint256) {} | ||
|
||
function hasVoted(uint256, address) public pure virtual override returns (bool) {} | ||
|
||
function _quorumReached(uint256) internal pure virtual override returns (bool) {} | ||
|
||
function _voteSucceeded(uint256) internal pure virtual override returns (bool) {} | ||
|
||
function _getVotes(address, uint256, bytes memory) internal pure virtual override returns (uint256) {} | ||
|
||
function _countVote(uint256, address, uint8, uint256, bytes memory) internal virtual override {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters