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

fork tests in CI #317

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
NOVA_URL=
ARB_URL=
ETH_URL=
12 changes: 6 additions & 6 deletions test/gov-actions/AIPNovaFeeRoutingAction.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import "../../src/UpgradeExecutor.sol";
contract AIPNovaFeeRoutingActionTest is Test {
UpgradeExecutor constant upExec = UpgradeExecutor(0x86a02dD71363c440b21F4c0E5B2Ad01Ffe1A7482);

function testAction() public {
if (!isFork()) {
return;
}
function setUp() public {
vm.createSelectFork(vm.envString("NOVA_URL"), 74298960);
}

function testAction() public {
AIPNovaFeeRoutingAction action = new AIPNovaFeeRoutingAction();

// before we run the action, we need to make sure the upgrade executor has at least this much ETH
Expand All @@ -26,7 +26,7 @@ contract AIPNovaFeeRoutingActionTest is Test {

// make sure the new recipients are set

address[1] memory expectedL1SurplusRecipients = [0xd9a2e0E5d7509F0BF1B2d33884F8C1b4D4490879];
address[1] memory expectedL1SurplusRecipients = [0x36D0170D92F66e8949eB276C3AC4FEA64f83704d];
uint256[1] memory expectedL1SurplusWeights = [uint(10_000)];

assertEq(IRewardDistributor(action.novaL1SurplusFeeDistr()).currentRecipientGroup(), keccak256(abi.encodePacked(expectedL1SurplusRecipients)));
Expand All @@ -36,7 +36,7 @@ contract AIPNovaFeeRoutingActionTest is Test {


address[7] memory expectedBaseFeeRecipients = [
0xd9a2e0E5d7509F0BF1B2d33884F8C1b4D4490879, // nova to l1 router
0x36D0170D92F66e8949eB276C3AC4FEA64f83704d, // nova to l1 router
0xD0749b3e537Ed52DE4e6a3Ae1eB6fc26059d0895, // rest are same as current
0x41C327d5fc9e29680CcD45e5E52446E0DB3DAdFd,
0x02C2599aa929e2509741b44F3a13029745aB1AB2,
Expand Down
34 changes: 9 additions & 25 deletions test/gov-actions/NomineeGovernorV2UpgradeAction.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,16 @@ contract NomineeGovernorV2UpgradeActionTest is Test {
// see https://github.com/ArbitrumFoundation/docs/pull/731/commits/0837520dccc12e56a25f62de90ff9e3869196d05
bytes32 newConstitutionHash = 0xe794b7d0466ffd4a33321ea14c307b2de987c3229cf858727052a6f4b8a19cc1;

address newImplementation = address(new SecurityCouncilNomineeElectionGovernor());
uint256 votingDelay = 7 days;
NomineeGovernorV2UpgradeActionTemplate action = new NomineeGovernorV2UpgradeActionTemplate(
address(proxyAdmin),
address(gov),
newImplementation,
votingDelay,
address(constitution),
newConstitutionHash
);
uint256 votingDelay = 50400;
NomineeGovernorV2UpgradeAction action;

function testAction() external {
if (!_isForkTest()) {
console.log("not fork test, skipping NomineeGovernorV2UpgradeActionTest");
return;
}
function setUp() external {
vm.createSelectFork(vm.envString("ARB_URL"), 173727923);

action = new NomineeGovernorV2UpgradeAction();
}

function testAction() external {
if (_getImplementation() != oldImplementation) {
console.log("implementation not set to old implementation, skipping NomineeGovernorV2UpgradeActionTest");
return;
Expand All @@ -49,7 +42,7 @@ contract NomineeGovernorV2UpgradeActionTest is Test {

assertEq(
_getImplementation(),
newImplementation,
action.newNomineeElectionGovernorImplementation(),
"implementation not set"
);

Expand All @@ -63,13 +56,4 @@ contract NomineeGovernorV2UpgradeActionTest is Test {
function _getImplementation() internal view returns (address) {
return proxyAdmin.getProxyImplementation(TransparentUpgradeableProxy(payable(gov)));
}

function _isForkTest() internal view returns (bool) {
bool isForkTest;
address _gov = address(gov);
assembly {
isForkTest := gt(extcodesize(_gov), 0)
}
return isForkTest;
}
}
9 changes: 4 additions & 5 deletions test/gov-actions/SwitchManagerRolesAction.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import "../../src/gov-action-contracts/nonemergency/SwitchManagerRolesAction.sol
contract SwitchManagerRolesActionTest is Test {
UpgradeExecutor arbOneUe = UpgradeExecutor(0xCF57572261c7c2BCF21ffD220ea7d1a27D40A827);

function testAction() external {
if (!isFork()) {
console.log("not fork test, skipping SwitchManagerRolesActionTest");
return;
}
function setUp() external {
vm.createSelectFork(vm.envString("ARB_URL"), 221131972);
}

function testAction() external {
SwitchManagerRolesAction gac = new SwitchManagerRolesAction();

address emergencyCouncil = gac.emergencyCouncil();
Expand Down
Loading