-
Notifications
You must be signed in to change notification settings - Fork 213
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
Feat/upgrade on forking #978
base: feat/vaults
Are you sure you want to change the base?
Changes from 1 commit
42c64b6
3673df4
ac5e23b
969dcf5
9f00310
9a18b10
c3840d5
2fa8d9a
ba9417a
ef7c242
43814a5
67c7d88
23877f5
ed61031
d1bf561
be49584
7554864
a3685a5
863a3c0
df4508d
8f21f92
896bd55
1167c03
47fb019
57074e0
bf8c893
1d0144a
d1a589c
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 |
---|---|---|
|
@@ -54,6 +54,9 @@ | |
function isMigrationAllowed() external view returns (bool); | ||
} | ||
|
||
interface IStakingRouter is IAccessControlEnumerable { | ||
} | ||
|
||
interface IUpgradeableBeacon { | ||
function implementation() external view returns (address); | ||
function owner() external view returns (address); | ||
|
@@ -64,10 +67,6 @@ | |
function implementation() external view returns (address); | ||
} | ||
|
||
interface IWithdrawalVault is IAccessControlEnumerable, IVersioned, IWithdrawalsManagerProxy { | ||
function getConsensusContract() external view returns (address); | ||
} | ||
|
||
interface IVaultFactory { | ||
function BEACON() external view returns (address); | ||
function DELEGATION_IMPL() external view returns (address); | ||
|
@@ -143,7 +142,6 @@ | |
// New non-aragon implementations | ||
address accountingOracleImplementation; | ||
address newLocatorImplementation; | ||
address withdrawalVaultImplementation; | ||
|
||
// Existing proxies and contracts | ||
address agent; | ||
|
@@ -156,13 +154,13 @@ | |
address wstETH; | ||
} | ||
// Old upgraded non-proxy contracts | ||
IBurner public immutable _oldBurner; | ||
IOracleReportSanityChecker public immutable _oldOracleReportSanityChecker; | ||
|
||
// New proxy contracts | ||
IAccounting public immutable _accounting; | ||
IVaultHub public immutable _vaultHub; | ||
IPredepositGuarantee public immutable _predepositGuarantee; | ||
|
||
// New non-proxy contracts | ||
IBurner public immutable _burner; | ||
|
@@ -180,7 +178,6 @@ | |
// New non-aragon implementations | ||
address public immutable _accountingOracleImplementation; | ||
address public immutable _newLocatorImplementation; | ||
address public immutable _withdrawalVaultImplementation; | ||
|
||
// Existing proxies and contracts | ||
address public immutable _agent; | ||
|
@@ -192,10 +189,10 @@ | |
ILidoLocator public immutable _locator; | ||
address public immutable _nodeOperatorsRegistry; | ||
address public immutable _simpleDvt; | ||
IStakingRouter public immutable _stakingRouter; | ||
address public immutable _validatorsExitBusOracle; | ||
address public immutable _voting; | ||
address public immutable _withdrawalQueue; | ||
IWithdrawalVault public immutable _withdrawalVault; | ||
address public immutable _wstETH; | ||
|
||
// Values to set | ||
|
@@ -234,10 +231,8 @@ | |
keccak256("SECOND_OPINION_MANAGER_ROLE"); | ||
bytes32 public constant INITIAL_SLASHING_AND_PENALTIES_MANAGER_ROLE = | ||
keccak256("INITIAL_SLASHING_AND_PENALTIES_MANAGER_ROLE"); | ||
|
||
// WithdrawalVault | ||
bytes32 internal constant ADD_FULL_WITHDRAWAL_REQUEST_ROLE = keccak256("ADD_FULL_WITHDRAWAL_REQUEST_ROLE"); | ||
|
||
// StakingRouter | ||
bytes32 public constant REPORT_REWARDS_MINTED_ROLE = keccak256("REPORT_REWARDS_MINTED_ROLE"); | ||
// VaultHub | ||
bytes32 public constant VAULT_MASTER_ROLE = keccak256("Vaults.VaultHub.VaultMasterRole"); | ||
bytes32 public constant VAULT_REGISTRY_ROLE = keccak256("Vaults.VaultHub.VaultRegistryRole"); | ||
|
@@ -248,7 +243,6 @@ | |
|
||
uint256 internal constant EXPECTED_FINAL_LIDO_VERSION = 3; | ||
uint256 internal constant EXPECTED_FINAL_ACCOUNTING_ORACLE_VERSION = 3; | ||
uint256 internal constant EXPECTED_FINAL_WITHDRAWAL_VAULT_VERSION = 2; | ||
|
||
// | ||
// Constants | ||
|
@@ -304,17 +298,16 @@ | |
|
||
_accountingOracleImplementation = params.accountingOracleImplementation; | ||
_newLocatorImplementation = params.newLocatorImplementation; | ||
_withdrawalVaultImplementation = params.withdrawalVaultImplementation; | ||
|
||
_oldBurner = IBurner(_locator.burner()); | ||
_oldOracleReportSanityChecker = IOracleReportSanityChecker(_locator.oracleReportSanityChecker()); | ||
_oracleReportSanityChecker = IOracleReportSanityChecker(params.oracleReportSanityChecker); | ||
_accountingOracle = IAccountingOracle(_locator.accountingOracle()); | ||
_elRewardsVault = _locator.elRewardsVault(); | ||
_stakingRouter = IStakingRouter(_locator.stakingRouter()); | ||
_lido = ILido(_locator.lido()); | ||
_validatorsExitBusOracle = _locator.validatorsExitBusOracle(); | ||
_withdrawalQueue = _locator.withdrawalQueue(); | ||
_withdrawalVault = IWithdrawalVault(_locator.withdrawalVault()); | ||
} | ||
|
||
/// @notice Must be called after LidoLocator is upgraded | ||
|
@@ -416,9 +409,6 @@ | |
} | ||
|
||
function _assertInitialProxyImplementations() internal view { | ||
if (_withdrawalVault.implementation() != _withdrawalVaultImplementation) { | ||
revert IncorrectInitialImplementation(address(_withdrawalVault)); | ||
} | ||
} | ||
|
||
function _assertZeroOZRoleHolders(IAccessControlEnumerable accessControlled, bytes32 role) internal view { | ||
|
@@ -467,10 +457,6 @@ | |
|
||
_assertBurnerAllowances(); | ||
|
||
if (_withdrawalVault.implementation() != _withdrawalVaultImplementation) { | ||
revert IncorrectProxyImplementation(address(_withdrawalVault), _withdrawalVaultImplementation); | ||
} | ||
|
||
if (_vaultFactory.BEACON() != address(_upgradeableBeacon)) { | ||
revert IncorrectVaultFactoryBeacon(address(_vaultFactory), address(_upgradeableBeacon)); | ||
} | ||
|
@@ -538,12 +524,12 @@ | |
} | ||
} | ||
|
||
function _assertAragonAppImplementation(IAragonAppRepo repo, address implementation) internal view { | ||
(, address actualImplementation, ) = repo.getLatest(); | ||
if (actualImplementation != implementation) { | ||
revert IncorrectAragonAppImplementation(address(repo), implementation); | ||
} | ||
} | ||
|
||
function _assertFinalACL() internal view { | ||
address agent = _agent; | ||
|
@@ -551,19 +537,17 @@ | |
// Burner | ||
IBurner burner = _burner; | ||
_assertSingleOZRoleHolder(burner, DEFAULT_ADMIN_ROLE, agent); | ||
address[] memory holders = new address[](4); | ||
holders[0] = address(_lido); | ||
holders[1] = _nodeOperatorsRegistry; | ||
holders[2] = _simpleDvt; | ||
holders[3] = address(_accounting); | ||
_assertOZRoleHolders(burner, REQUEST_BURN_SHARES_ROLE, holders); | ||
{ | ||
address[] memory holders = new address[](4); | ||
holders[0] = address(_lido); | ||
holders[1] = _nodeOperatorsRegistry; | ||
holders[2] = _simpleDvt; | ||
holders[3] = address(_accounting); | ||
_assertOZRoleHolders(burner, REQUEST_BURN_SHARES_ROLE, holders); | ||
} | ||
// NB: we don't check REQUEST_BURN_SHARES_ROLE on the old burner is revoked | ||
// because it is left intentionally to simplify aragon voting operations | ||
|
||
// WithdrawalVault | ||
_assertSingleOZRoleHolder(_withdrawalVault, DEFAULT_ADMIN_ROLE, _agent); | ||
_assertSingleOZRoleHolder(_withdrawalVault, ADD_FULL_WITHDRAWAL_REQUEST_ROLE, _validatorsExitBusOracle); | ||
|
||
// VaultHub | ||
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. here will be PDG too
|
||
_assertSingleOZRoleHolder(_vaultHub, DEFAULT_ADMIN_ROLE, _agent); | ||
_assertSingleOZRoleHolder(_vaultHub, VAULT_MASTER_ROLE, _agent); | ||
|
@@ -582,12 +566,19 @@ | |
|
||
// PredepositGuarantee | ||
_assertProxyAdmin(_predepositGuarantee, _agent); | ||
|
||
// StakingRouter | ||
{ | ||
address[] memory holders = new address[](2); | ||
holders[0] = address(_lido); | ||
holders[1] = address(_accounting); | ||
_assertOZRoleHolders(_stakingRouter, REPORT_REWARDS_MINTED_ROLE, holders); | ||
} | ||
} | ||
|
||
function _checkContractVersions() internal view { | ||
_assertContractVersion(_lido, EXPECTED_FINAL_LIDO_VERSION); | ||
_assertContractVersion(_accountingOracle, EXPECTED_FINAL_ACCOUNTING_ORACLE_VERSION); | ||
_assertContractVersion(_withdrawalVault, EXPECTED_FINAL_WITHDRAWAL_VAULT_VERSION); | ||
} | ||
|
||
function _assertContractVersion(IVersioned versioned, uint256 expectedVersion) internal view { | ||
|
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. 🧠 Testnet and Mainnet both together? |
Unchanged files with check annotations Beta
// SPDX-License-Identifier: GPL-3.0 | ||
/* See contracts/COMPILERS.md */ | ||
pragma solidity 0.4.24; | ||
import {UnstructuredStorage} from "@aragon/os/contracts/common/UnstructuredStorage.sol"; | ||
/* See contracts/COMPILERS.md */ | ||
pragma solidity 0.4.24; | ||
import "@aragon/os/contracts/apps/AragonApp.sol"; | ||
Check warning on line 7 in contracts/0.4.24/oracle/LegacyOracle.sol
|
||
import "../../common/interfaces/ILidoLocator.sol"; | ||
Check warning on line 9 in contracts/0.4.24/oracle/LegacyOracle.sol
|
||
import "../utils/Versioned.sol"; | ||
interface IAccountingOracle { |
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity 0.4.24; | ||
import "@aragon/os/contracts/common/UnstructuredStorage.sol"; | ||
Check warning on line 5 in contracts/0.4.24/utils/Versioned.sol
|
||
/** | ||
* @title Adapted code of /contracts/0.8.9/utils/Versioned.sol |
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.
precondition: