Skip to content

Commit

Permalink
proposalCount fix (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
wildmolasses authored Dec 23, 2024
1 parent 45fac85 commit 6036b80
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions contracts/CompoundGovernor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ contract CompoundGovernor is
_setNextProposalId(compoundGovernorBravo.proposalCount() + 1);
}

/// @inheritdoc GovernorSequentialProposalIdUpgradeable
/// @dev Since GovernorBravo indexed from 1, we decrement the proposal count by 1.
function proposalCount() public view override returns (uint256) {
return super.proposalCount() - 1;
}

/// @notice A modified `hashProposal` that supports sequential proposal IDs.
function hashProposal(
address[] memory _targets,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ contract GovernorSequentialProposalIdUpgradeableTest is CompoundGovernorTest {

contract ProposalCount is GovernorSequentialProposalIdUpgradeableTest {
function test_ReturnsCorrectProposalCount() public {
assertEq(governor.proposalCount(), compoundGovernorBravo.proposalCount() + 1);
assertEq(governor.proposalCount(), compoundGovernorBravo.proposalCount());
}

function testFuzz_ProposalCreatedEventEmittedWithEnumeratedProposalId(uint256 _newValue) public {
Expand Down

0 comments on commit 6036b80

Please sign in to comment.