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

Added post-proposal Alpha tests and Bravo tests #8

Merged
merged 9 commits into from
Dec 7, 2023
Merged

Conversation

jferas
Copy link
Contributor

@jferas jferas commented Nov 13, 2023

Added tests for Alpha governor after upgrade proposal and proposal actions on Bravo governor.

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.

Looking good a few small comments

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

import {ERC20VotesComp} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20VotesComp.sol";
import {console2} from "forge-std/console2.sol";

Choose a reason for hiding this comment

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

Leftover console import

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 b06582b

assertEq(TIMELOCK.balance, _timelockETHBalance - _amount);
}

// TODO: This test commented out as the timelock has no ETH as of 2023-11-08

Choose a reason for hiding this comment

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

It would be good to create an issue and link it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

New issue created.. #16

Copy link
Contributor

Choose a reason for hiding this comment

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

related a bit to this TODO: the question had come up for me earlier, why not deal / vm.deal some ETH / tokens to addresses in relevant tests? not saying we should do it, just curious if there's a reason not to

Choose a reason for hiding this comment

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

I don't think there is a reason not to

Copy link
Contributor Author

@jferas jferas Nov 27, 2023

Choose a reason for hiding this comment

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

As it turns out we already had a test like this with "vm.deal".. this was a test with "nodeal" in the name, removed it.. 1832b53

foundry.toml Outdated
@@ -10,7 +10,7 @@
verbosity = 3

[profile.ci]
fuzz = { runs = 5000 }
fuzz = { runs = 50 }

Choose a reason for hiding this comment

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

One thing we did in the PoolTogether upgrade to help deal with all of these tests was to also use a fuzz seed.

Choose a reason for hiding this comment

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

It would involve adding to the foundry.toml and updating the c

fuzz = { seed = 0x1 }

Choose a reason for hiding this comment

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

And also update the CI. There is an example in the PoolTogether upgrade

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 aa49609


// Counter-intuitively, the Governor (not the Timelock) must hold the ETH.
// See the deployed GovernorAlpha, line 281:
// https://etherscan.io/address/0x31c8EAcBFFdD875c74b94b077895Bd78CF1E64A3#code

Choose a reason for hiding this comment

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

I think this address might be the Radicle token not the Radicle governor

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.

Was done in this commit in PR 14 .. 8f5e79e

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.

some comments / questions / nits, thanks @jferas !

assertEq(_token.balanceOf(_receiver), _receiverTokenBalance, "Receiver balance is incorrect");
}

////
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: these section headings are formatted differently from one another. not sure if that's intentional.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not intentional, done: 1eb42ac

test/RadworksGovernor.t.sol Outdated Show resolved Hide resolved
assertEq(TIMELOCK.balance, _timelockETHBalance - _amount);
}

// TODO: This test commented out as the timelock has no ETH as of 2023-11-08
Copy link
Contributor

Choose a reason for hiding this comment

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

related a bit to this TODO: the question had come up for me earlier, why not deal / vm.deal some ETH / tokens to addresses in relevant tests? not saying we should do it, just curious if there's a reason not to

test/RadworksGovernor.t.sol Show resolved Hide resolved
_jumpToActiveProposal(_newProposalId);

// Delegates vote with a mix of For/Against/Abstain with For winning.
// TODO: Need more delegates for this.. pool together had more!
Copy link
Contributor

Choose a reason for hiding this comment

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

just curious, can you elaborate on why we need more delegates?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should be able to pull all of the "need more delegates" in a future PR, as we've been able to test with the delegates we have.

Copy link
Contributor

Choose a reason for hiding this comment

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

i'm confused why we are adding these comments if we don't need them! i won't block merge on it though.

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 besides the comments thing, but that might just be my own misunderstanding. mergeable!

@jferas jferas changed the base branch from initial-tests to main December 7, 2023 15:32
Copy link

github-actions bot commented Dec 7, 2023

Coverage after merging test-group-1 into initial-tests will be

76.00%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   RadworksGovernor.sol73.91%75%69.23%76%101, 126–127, 135, 138, 152, 203, 84

@jferas jferas merged commit 07a8dee into main Dec 7, 2023
10 of 11 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