-
Notifications
You must be signed in to change notification settings - Fork 11
Create VIP Simulation Framework #91
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
Changes from all commits
80ab7f4
2061e33
d315226
4ff96e3
b6e8c40
3e6fd2e
13547fd
0008a54
bb25358
661cffb
14d1d61
bf2d7dd
fe0d173
477b474
f6eebec
933cca9
3e55d05
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,19 @@ library ArbitrumAddresses { | |
| 0x14eCB5Ff2A78364E0FF443B7F0F6e0e393531484; | ||
| address public constant DEPLOYER = | ||
| 0x25dCffa22EEDbF0A69F6277e24C459108c186ecB; | ||
|
|
||
| address public constant TIMELOCK_CONTROLLER = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,12 +17,21 @@ library MainnetAddresses { | |
| 0x860fa85f04f9d35B3471D8F7F7fA3Ad31Ce4D5Ae; | ||
| address public constant VOLT_FEI_PSM = | ||
| 0x985f9C331a9E4447C782B98D6693F5c7dF8e560e; | ||
|
|
||
| address public constant TIMELOCK_CONTROLLER = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 = | ||
|
|
||
This file was deleted.
| 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); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
| } | ||
| } | ||
| 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 { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
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
testkey, why not renametest-forgeto justtest?