Skip to content
Merged
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
30 changes: 2 additions & 28 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ jobs:
- run:
name: Install dependencies
command: npm install
- run:
name: Compile contracts
command: npm run compile:hardhat
- save_cache:
key: repo-{{ .Environment.CIRCLE_SHA1 }}
paths:
Expand All @@ -33,31 +30,11 @@ jobs:
name: Run linter
command: npm run lint

test:
working_directory: ~/repo
docker:
- image: circleci/node:14
parallelism: 16
resource_class: large
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Run tests
command: |
circleci tests glob "test/unit/**/*.ts" | circleci tests split --split-by=filesize > /tmp/tests-to-run
npm run test:hardhat $(cat /tmp/tests-to-run)
- store_test_results:
path: test-results
- store_artifacts:
path: test-results

test-forge:
Copy link
Contributor

Choose a reason for hiding this comment

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

If you're removing the test key, why not rename test-forge to just test?

working_directory: ~/repo
docker:
- image: cimg/node:16.14
resource_class: xlarge
resource_class: large
steps:
- checkout
- restore_cache:
Expand All @@ -76,7 +53,7 @@ jobs:
name: Run tests
command: |
source /home/circleci/.bashrc
export PATH=$PATH:/home/circleci/.foundry/bin; npm run clean && npm run compile && npm run test && npm run test:integration && npm run test:integration:arbitrum
export PATH=$PATH:/home/circleci/.foundry/bin; npm run test && npm run test:integration && npm run test:integration:arbitrum && npm run test:proposal:mainnet && npm run test:proposal:arbitrum

workflows:
main:
Expand All @@ -85,9 +62,6 @@ workflows:
- lint:
requires:
- build
- test:
requires:
- build
- test-forge:
requires:
- build
13 changes: 13 additions & 0 deletions contracts/test/integration/fixtures/ArbitrumAddresses.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ library ArbitrumAddresses {
0x14eCB5Ff2A78364E0FF443B7F0F6e0e393531484;
address public constant DEPLOYER =
0x25dCffa22EEDbF0A69F6277e24C459108c186ecB;

address public constant TIMELOCK_CONTROLLER =
Copy link
Contributor

Choose a reason for hiding this comment

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

I would rename this to be more specific to whatever timelock it is. Presume it's the Volt optimistic timelock?

0x2c01C9166FA3e16c24c118053E346B1DD8e72dE8;

/// current active EOA's
address public constant EOA_1 = 0xB320e376Be6459421695F2b6B1E716AE4bc8129A;
address public constant EOA_2 = 0xd90E9181B20D8D1B5034d9f5737804Da182039F6;
address public constant EOA_3 = 0xA96D4a5c343d6fE141751399Fc230E9E8Ecb6fb6;

/// inactive EOA's
address public constant REVOKED_EOA_1 =
0xf8D0387538E8e03F3B4394dA89f221D7565a28Ee;

address public constant DEPRECATED_TIMELOCK =
0x980A05105a53eCa7745DA40DF1AdE6674fc73eD5;

Expand Down
9 changes: 9 additions & 0 deletions contracts/test/integration/fixtures/MainnetAddresses.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,21 @@ library MainnetAddresses {
0x860fa85f04f9d35B3471D8F7F7fA3Ad31Ce4D5Ae;
address public constant VOLT_FEI_PSM =
0x985f9C331a9E4447C782B98D6693F5c7dF8e560e;

address public constant TIMELOCK_CONTROLLER =
Copy link
Contributor

Choose a reason for hiding this comment

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

Would rename this to describe functionally what it does

0x75d078248eE49c585b73E73ab08bb3eaF93383Ae;

/// current active EOA's
address public constant OTC_LOAN_REPAYMENT =
0x590eb1a809377f786a11fa1968eF8c15eB44A12F;
address public constant EOA_1 = 0xB320e376Be6459421695F2b6B1E716AE4bc8129A;
address public constant EOA_2 = 0xd90E9181B20D8D1B5034d9f5737804Da182039F6;
address public constant EOA_3 = 0xA96D4a5c343d6fE141751399Fc230E9E8Ecb6fb6;

/// inactive EOA's
address public constant REVOKED_EOA_1 =
0xf8D0387538E8e03F3B4394dA89f221D7565a28Ee;

address public constant NC_PSM = 0x18f251FC3CE0Cb690F13f62213aba343657d0E72;
address public constant GRLM = 0x87945f59E008aDc9ed6210a8e061f009d6ace718;
address public constant PCV_GUARD_ADMIN =
Expand Down
16 changes: 4 additions & 12 deletions contracts/test/integration/utils/AllArbitrumRoles.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,12 @@ import {Core} from "../../../core/Core.sol";
import {Vm} from "./../../unit/utils/Vm.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {RoleTesting} from "./RoleTesting.sol";
import {ArbitrumRolesConfig} from "./ArbitrumRolesConfig.sol";
import {AllRolesConfig} from "./AllRolesConfig.sol";

contract ArbitrumTestAllArbitrumRoles is RoleTesting, ArbitrumRolesConfig {
contract ArbitrumTestAllArbitrumRoles is RoleTesting, AllRolesConfig {
Core private core = Core(ArbitrumAddresses.CORE);

function setUp() public {
allRoles.push(TribeRoles.GOVERNOR);
allRoles.push(TribeRoles.GUARDIAN);
allRoles.push(TribeRoles.PCV_CONTROLLER);
allRoles.push(TribeRoles.MINTER);
allRoles.push(TribeRoles.PCV_GUARD);
allRoles.push(TribeRoles.PCV_GUARD_ADMIN);
allRoles.push(TribeRoles.PSM_ADMIN_ROLE);

for (uint256 i = 0; i < allRoles.length; i++) {
numEachRole.push(core.getRoleMemberCount(allRoles[i]));
}
Expand All @@ -49,11 +41,11 @@ contract ArbitrumTestAllArbitrumRoles is RoleTesting, ArbitrumRolesConfig {

/// load up number of roles from Core and ensure that they match up with numbers here
function testRoleArity() public view {
_testRoleArity(allRoles, roleCounts, numEachRole);
_testRoleArity(getAllRoles(), roleCounts, numEachRole);
}

/// assert that all addresses have the proper role
function testRoleAddresses() public {
_testRoleAddresses(allRoles, allAddresses, core);
_testRoleAddresses(getAllRoles(), allAddresses, core);
}
}
62 changes: 0 additions & 62 deletions contracts/test/integration/utils/AllMainnetRoles.sol

This file was deleted.

87 changes: 87 additions & 0 deletions contracts/test/integration/utils/AllRoles.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;

import {Core} from "../../../core/Core.sol";
import {MainnetAddresses} from "../fixtures/MainnetAddresses.sol";
import {ArbitrumAddresses} from "../fixtures/ArbitrumAddresses.sol";
import {TribeRoles} from "../../../core/TribeRoles.sol";
import {DSTest} from "./../../unit/utils/DSTest.sol";
import {L2Core} from "../../../core/L2Core.sol";
import {Core} from "../../../core/Core.sol";
import {Vm} from "./../../unit/utils/Vm.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {RoleTesting} from "./RoleTesting.sol";
import {AllRolesConfig} from "./AllRolesConfig.sol";

contract AllRoles is RoleTesting, AllRolesConfig {
/// System should look the same in terms of who has roles, and what roles exist
/// on both mainnet and arbitrum
function _setupMainnet(Core core) internal {
/// wipe the slate clean before each test
delete numEachRole;

for (uint256 i = 0; i < allAddresses.length; i++) {
delete allAddresses[i];
}

for (uint256 i = 0; i < allRoles.length; i++) {
numEachRole.push(core.getRoleMemberCount(allRoles[i]));
}

allAddresses[0].push(MainnetAddresses.CORE);
Copy link
Contributor

Choose a reason for hiding this comment

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

Like this utils a lot

allAddresses[0].push(MainnetAddresses.GOVERNOR);
allAddresses[0].push(MainnetAddresses.TIMELOCK_CONTROLLER);

allAddresses[1].push(MainnetAddresses.PCV_GUARDIAN);

allAddresses[2].push(MainnetAddresses.GOVERNOR);
allAddresses[2].push(MainnetAddresses.PCV_GUARDIAN);

allAddresses[4].push(MainnetAddresses.EOA_1);
allAddresses[4].push(MainnetAddresses.EOA_2);
allAddresses[4].push(MainnetAddresses.EOA_3);

allAddresses[5].push(MainnetAddresses.PCV_GUARD_ADMIN);
}

function _setupArbitrum(Core core) internal {
/// wipe the slate clean before each test
delete numEachRole;

for (uint256 i = 0; i < allAddresses.length; i++) {
delete allAddresses[i];
}

for (uint256 i = 0; i < allRoles.length; i++) {
numEachRole.push(core.getRoleMemberCount(allRoles[i]));
}

allAddresses[0].push(ArbitrumAddresses.CORE);
allAddresses[0].push(ArbitrumAddresses.GOVERNOR);
allAddresses[0].push(ArbitrumAddresses.TIMELOCK_CONTROLLER);

allAddresses[1].push(ArbitrumAddresses.PCV_GUARDIAN);

allAddresses[2].push(ArbitrumAddresses.GOVERNOR);
allAddresses[2].push(ArbitrumAddresses.PCV_GUARDIAN);

allAddresses[4].push(ArbitrumAddresses.EOA_1);
allAddresses[4].push(ArbitrumAddresses.EOA_2);
allAddresses[4].push(ArbitrumAddresses.EOA_3);

allAddresses[5].push(ArbitrumAddresses.PCV_GUARD_ADMIN);

/// sanity check
assert(numEachRole.length == allRoles.length);
}

/// load up number of roles from Core and ensure that they match up with numbers here
function testRoleArity() public {
_testRoleArity(getAllRoles(), roleCounts, numEachRole);
}

/// assert that all addresses have the proper role
function testRoleAddresses(Core core) public {
_testRoleAddresses(getAllRoles(), allAddresses, core);
}
}
67 changes: 67 additions & 0 deletions contracts/test/integration/utils/AllRolesConfig.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
pragma solidity =0.8.13;

import {TribeRoles} from "contracts/core/TribeRoles.sol";

contract AllRolesConfig {
Copy link
Contributor

Choose a reason for hiding this comment

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

Really like this config of all roles, easy to see in one place what the role setup is

/// @notice all roles
bytes32[7] public allRoles = [
TribeRoles.GOVERNOR,
TribeRoles.GUARDIAN,
TribeRoles.PCV_CONTROLLER,
TribeRoles.MINTER,
TribeRoles.PCV_GUARD,
TribeRoles.PCV_GUARD_ADMIN,
TribeRoles.PSM_ADMIN_ROLE
];

/// how many of each role exists
uint256[] public numEachRole;

/// @notice array of arrays that has all addresses in each role
address[][7] public allAddresses;

/// ------ @notice number of each role in the system ------

/// new timelock, multisig, core
uint256 public constant numGovernors = 3;

/// PCV Guardian
uint256 public constant numGuardians = 1;

/// multisig, PCV Guardian
uint256 public constant numPCVControllers = 2;

/// Global Rate Limited Minter
uint256 public constant numMinters = 0;

/// EOA1, EOA2 & EOA3
uint256 public constant numPCVGuards = 3;

/// PCV Guard Admin
uint256 public constant numPCVGuardAdmins = 1;

/// NA
uint256 public constant numPSMAdmins = 0;

/// @notice all the number of each roles in order of the allRoles array
uint256[7] public roleCounts = [
numGovernors,
numGuardians,
numPCVControllers,
numMinters,
numPCVGuards,
numPCVGuardAdmins,
numPSMAdmins
];

function getAllRoles() public view returns (bytes32[] memory) {
uint256 roleLen = allRoles.length;
bytes32[] memory allRolesArray = new bytes32[](roleLen);

for (uint256 i = 0; i < roleLen; i++) {
allRolesArray[i] = allRoles[i];
}

return allRolesArray;
}
}
Loading