Skip to content

Commit

Permalink
Add deploy broadcast file; test against deployed governor (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
wildmolasses authored Sep 23, 2024
1 parent afa1db7 commit eeb1ff6
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 50 deletions.
108 changes: 108 additions & 0 deletions broadcast/Deploy.s.sol/1/run-1721063504.json

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions script/DeployInput.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,4 @@ contract DeployInput {
uint256 constant INITIAL_VOTING_DELAY = 7200; // in blocks; 5 blocks/min * 60 * 24 = 1 day
uint256 constant INITIAL_VOTING_PERIOD = 17_280; // matches existing config
uint256 constant INITIAL_PROPOSAL_THRESHOLD = 1_000_000e18; // matches existing config

// ScopeLift address for receiving the RAD tokens upon upgrade execution
address constant SCOPELIFT_ADDRESS = 0x5C04E7808455ee0e22c2773328C151d0DD79dC62;

// Number of RAD tokens to transfer to ScopeLift upon upgrade execution
uint256 constant SCOPELIFT_PAYMENT = 5000e18;
}
2 changes: 1 addition & 1 deletion script/Propose.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {DeployInput} from "script/DeployInput.sol";
/// @notice Script to submit the proposal to upgrade Radworks governor.
contract Propose is Script, Constants, DeployInput {
IGovernorAlpha constant RADWORK_GOVERNOR_ALPHA = IGovernorAlpha(GOVERNOR_ALPHA);
address PROPOSER_ADDRESS = 0x464D78a5C97A2E2E9839C353ee9B6d4204c90B0b; // cloudhead.eth
address PROPOSER_ADDRESS = PROPOSER; // abbey

function propose(RadworksGovernor _newGovernor) internal returns (uint256 _proposalId) {
address[] memory _targets = new address[](3);
Expand Down
9 changes: 6 additions & 3 deletions test/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ contract Constants {
address constant TIMELOCK = 0x8dA8f82d2BbDd896822de723F55D6EdF416130ba;
address constant DRIPS = 0xd0Dd053392db676D57317CD4fe96Fc2cCf42D0b4;

address constant PROPOSER = 0x464D78a5C97A2E2E9839C353ee9B6d4204c90B0b; // cloudhead.eth
address constant PROPOSER = 0xEA95cfB5Dd624F43775b372db0ED2D8d0073E91C; // Abbey
// ScopeLift address for receiving the RAD tokens upon upgrade execution
address constant SCOPELIFT_ADDRESS = 0x5C04E7808455ee0e22c2773328C151d0DD79dC62;
// Number of RAD tokens to transfer to ScopeLift upon upgrade execution
uint256 constant SCOPELIFT_PAYMENT = 8065e18;

address constant USDC_ADDRESS = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
address constant GTC_ADDRESS = 0xDe30da39c46104798bB5aA3fe8B9e0e1F348163F;
address constant WETH_ADDRESS = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
address constant MTV_ADDRESS = 0x6226e00bCAc68b0Fe55583B90A1d727C14fAB77f;
uint256 constant MAX_REASONABLE_TIME_PERIOD = 302_400; // 6 weeks assume a 12 sec block time

// we have not yet deployed the Radworks Bravo Governor (will be replaced with deployed address)
address constant DEPLOYED_BRAVO_GOVERNOR = address(0x0);
address constant DEPLOYED_BRAVO_GOVERNOR = 0xD64D01D04498bFc60f04178e0B62a757C5048212;

uint256 constant QUORUM = 4_000_000e18;
}
38 changes: 19 additions & 19 deletions test/RadworksGovernor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1156,22 +1156,22 @@ contract _ExecuteTestWithDeployScriptGovernor is _Execute {
}
}

// Run the tests using the on-chain deployed Governor Bravo (when it has been deployed)

// contract ConstructorTestWithOnChainGovernor is Constructor {
// function _useDeployedGovernorBravo() internal pure override returns (bool) {
// return true;
// }
// }

// contract ProposeTestWithOnChainGovernor is Propose {
// function _useDeployedGovernorBravo() internal pure override returns (bool) {
// return true;
// }
// }

// contract _ExecuteTestWithOnChainGovernor is _Execute {
// function _useDeployedGovernorBravo() internal pure override returns (bool) {
// return true;
// }
// }
// Run the tests using the on-chain deployed Governor Bravo

contract ConstructorTestWithOnChainGovernor is Constructor {
function _useDeployedGovernorBravo() internal pure override returns (bool) {
return true;
}
}

contract ProposeTestWithOnChainGovernor is Propose {
function _useDeployedGovernorBravo() internal pure override returns (bool) {
return true;
}
}

contract _ExecuteTestWithOnChainGovernor is _Execute {
function _useDeployedGovernorBravo() internal pure override returns (bool) {
return true;
}
}
25 changes: 6 additions & 19 deletions test/helpers/ProposalTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,9 @@ abstract contract ProposalTest is RadworksGovernorTest {

function setUp() public virtual override {
RadworksGovernorTest.setUp();

if (_useDeployedGovernorBravo()) {
// Use the actual live proposal data expected to be on chain
// if Radworks Governor Bravo has already deployed
upgradeProposalId = 17; // assume this is the next proposal (as most recent is 16)
// Since the proposal was already submitted, the count before its submissions is one less
initialProposalCount = governorAlpha.proposalCount() - 1;
} else {
initialProposalCount = governorAlpha.proposalCount();

TestableProposeScript _proposeScript = new TestableProposeScript();
// We override the deployer to use an alternate delegate, because in this context,
// the PROPOSER_ADDRESS used already has a live proposal
_proposeScript.overrideProposerForTests(0x69dceee155C31eA0c8354F90BDD65C12FaF5A00a);

upgradeProposalId = _proposeScript.run(governorBravo);
}
initialProposalCount = governorAlpha.proposalCount();
TestableProposeScript _proposeScript = new TestableProposeScript();
upgradeProposalId = _proposeScript.run(governorBravo);
}

//--------------- HELPERS ---------------//
Expand All @@ -76,7 +62,7 @@ abstract contract ProposalTest is RadworksGovernorTest {
// https://etherscan.io/address/0x31c8EAcBFFdD875c74b94b077895Bd78CF1E64A3#code
&& _addr > address(0)
);
assumeNoPrecompiles(_addr);
assumeNotPrecompile(_addr);
}

function _assumeReceiver(address _receiver) internal {
Expand Down Expand Up @@ -116,7 +102,8 @@ abstract contract ProposalTest is RadworksGovernorTest {
}

function _jumpPastProposalEta() internal {
vm.roll(block.number + 1); // move up one block so we're not in the same block as when queued
vm.roll(vm.getBlockNumber() + 1); // move up one block so we're not in the same block as when
// queued
vm.warp(_upgradeProposalEta() + 1); // jump past the eta timestamp
}

Expand Down
2 changes: 1 addition & 1 deletion test/helpers/RadworksGovernorTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ abstract contract RadworksGovernorTest is Test, DeployInput, Constants {
function setUp() public virtual {
// The latest block when this test was written. If you update the fork block
// make sure to also update the top 6 delegates below.
uint256 _forkBlock = 18_514_244;
uint256 _forkBlock = 20_341_999;

vm.createSelectFork(vm.rpcUrl("mainnet"), _forkBlock);

Expand Down

0 comments on commit eeb1ff6

Please sign in to comment.