Skip to content

Commit

Permalink
feat: holesky deploy scripts (#473)
Browse files Browse the repository at this point in the history
* script: parser script helpers

* feat: holesky deploy scripts

* fix: config

* fix: ops multisig whitelister

* feat: track active validator count in pods (#474)

* chore: remove maxPods (#463)

* chore: remove maxPods

* docs: update docs

* refactor: set to private

* script: parser script helpers

* feat: holesky deploy scripts

* fix: config

* fix: ops multisig whitelister

* refactor: maxpods removal

* feat: preprod deployment

* refactor: reuse other script

---------

Co-authored-by: Alex <18387287+wadealexc@users.noreply.github.com>
  • Loading branch information
8sunyuan and wadealexc authored Mar 14, 2024
1 parent 3ba2b34 commit 43ffb52
Show file tree
Hide file tree
Showing 6 changed files with 923 additions and 18 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
RPC_MAINNET="https://eth.llamarpc.com"
# RPC_MAINNET="https://mainnet.infura.io/v3/API-KEY"
RPC_GOERLI="https://ethereum-goerli.publicnode.com"
RPC_HOLESKY=""
ETHERSCAN_API_KEY="API-KEY"
58 changes: 58 additions & 0 deletions script/configs/holesky/M2_deploy_from_scratch.holesky.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"chainInfo": {
"chainId": 17000
},
"multisig_addresses": {
"pauserMultisig": "0x53410249ec7d3a3F9F1ba3912D50D6A3Df6d10A7",
"communityMultisig": "0xCb8d2f9e55Bc7B1FA9d089f9aC80C583D2BDD5F7",
"operationsMultisig": "0xfaEF7338b7490b9E272d80A1a39f4657cAf2b97d",
"executorMultisig": "0x28Ade60640fdBDb2609D8d8734D1b5cBeFc0C348",
"timelock": "0xcF19CE0561052a7A7Ff21156730285997B350A7D"
},
"numStrategies": 2,
"strategies": {
"numStrategies": 2,
"MAX_PER_DEPOSIT": 115792089237316195423570985008687907853269984665640564039457584007913129639935,
"MAX_TOTAL_DEPOSITS": 115792089237316195423570985008687907853269984665640564039457584007913129639935,
"strategiesToDeploy": [
{
"token_address": "0x3F1c547b21f65e10480dE3ad8E19fAAC46C95034",
"token_name": "Liquid staked Ether 2.0",
"token_symbol": "stETH"
},
{
"token_address": "0x7322c24752f79c05FFD1E2a6FCB97020C1C264F1",
"token_name": "Rocket Pool ETH",
"token_symbol": "rETH"
}
]
},
"strategyManager": {
"init_strategy_whitelister": "0xfaEF7338b7490b9E272d80A1a39f4657cAf2b97d",
"init_paused_status": 0
},
"delegationManager": {
"init_paused_status": 0,
"init_minWithdrawalDelayBlocks": 50400
},
"avsDirectory": {
"init_paused_status": 0
},
"slasher": {
"init_paused_status": 0
},
"eigenPod": {
"MAX_RESTAKED_BALANCE_GWEI_PER_VALIDATOR": 32000000000000000000,
"GENESIS_TIME": 1695902400
},
"eigenPodManager": {
"init_paused_status": 0,
"deneb_fork_timestamp": "1707305664"
},
"delayedWithdrawalRouter": {
"init_paused_status": 0,
"init_withdrawalDelayBlocks": 50400
},
"ethPOSDepositAddress": "0x4242424242424242424242424242424242424242",
"beaconOracleAddress": "0x4C116BB629bff7A8373c2378bBd919f8349B8f25"
}
58 changes: 58 additions & 0 deletions script/configs/holesky/M2_deploy_preprod.holesky.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"chainInfo": {
"chainId": 17000
},
"multisig_addresses": {
"pauserMultisig": "0x0000000000000000000000000000000000000000",
"communityMultisig": "0x0000000000000000000000000000000000000000",
"operationsMultisig": "0x0000000000000000000000000000000000000000",
"executorMultisig": "0x0000000000000000000000000000000000000000",
"timelock": "0x0000000000000000000000000000000000000000"
},
"numStrategies": 2,
"strategies": {
"numStrategies": 2,
"MAX_PER_DEPOSIT": 115792089237316195423570985008687907853269984665640564039457584007913129639935,
"MAX_TOTAL_DEPOSITS": 115792089237316195423570985008687907853269984665640564039457584007913129639935,
"strategiesToDeploy": [
{
"token_address": "0x3F1c547b21f65e10480dE3ad8E19fAAC46C95034",
"token_name": "Liquid staked Ether 2.0",
"token_symbol": "stETH"
},
{
"token_address": "0x7322c24752f79c05FFD1E2a6FCB97020C1C264F1",
"token_name": "Rocket Pool ETH",
"token_symbol": "rETH"
}
]
},
"strategyManager": {
"init_strategy_whitelister": "0x0000000000000000000000000000000000000000",
"init_paused_status": 0
},
"delegationManager": {
"init_paused_status": 0,
"init_minWithdrawalDelayBlocks": 50400
},
"avsDirectory": {
"init_paused_status": 0
},
"slasher": {
"init_paused_status": 0
},
"eigenPod": {
"MAX_RESTAKED_BALANCE_GWEI_PER_VALIDATOR": 32000000000000000000,
"GENESIS_TIME": 1695902400
},
"eigenPodManager": {
"init_paused_status": 0,
"deneb_fork_timestamp": "1707305664"
},
"delayedWithdrawalRouter": {
"init_paused_status": 0,
"init_withdrawalDelayBlocks": 50400
},
"ethPOSDepositAddress": "0x4242424242424242424242424242424242424242",
"beaconOracleAddress": "0x4C116BB629bff7A8373c2378bBd919f8349B8f25"
}
206 changes: 206 additions & 0 deletions script/deploy/holesky/M2_Deploy_From_Scratch.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.12;

import "../../utils/ExistingDeploymentParser.sol";

/**
* @notice Script used for the first deployment of EigenLayer core contracts to Holesky
* forge script script/deploy/holesky/M2_Deploy_From_Scratch.s.sol --rpc-url http://127.0.0.1:8545 --private-key $PRIVATE_KEY --broadcast -vvvv
* forge script script/deploy/holesky/M2_Deploy_From_Scratch.s.sol --rpc-url $RPC_HOLESKY --private-key $PRIVATE_KEY --broadcast -vvvv
*
*/
contract M2_Deploy_Holesky_From_Scratch is ExistingDeploymentParser {
function run() external virtual {
_parseInitialDeploymentParams("script/configs/holesky/M2_deploy_from_scratch.holesky.config.json");

// START RECORDING TRANSACTIONS FOR DEPLOYMENT
vm.startBroadcast();

emit log_named_address("Deployer Address", msg.sender);

_deployFromScratch();

// STOP RECORDING TRANSACTIONS FOR DEPLOYMENT
vm.stopBroadcast();

// Sanity Checks
_verifyContractPointers();
_verifyImplementations();
_verifyContractsInitialized({isInitialDeployment: true});
_verifyInitializationParams();

logAndOutputContractAddresses("script/output/holesky/M2_deploy_from_scratch.holesky.config.json");
}

/**
* @notice Deploy EigenLayer contracts from scratch for Holesky
*/
function _deployFromScratch() internal {
// Deploy ProxyAdmin, later set admins for all proxies to be executorMultisig
eigenLayerProxyAdmin = new ProxyAdmin();

// Set multisigs as pausers, executorMultisig as unpauser
address[] memory pausers = new address[](3);
pausers[0] = executorMultisig;
pausers[1] = operationsMultisig;
pausers[2] = pauserMultisig;
address unpauser = executorMultisig;
eigenLayerPauserReg = new PauserRegistry(pausers, unpauser);

/**
* First, deploy upgradeable proxy contracts that **will point** to the implementations. Since the implementation contracts are
* not yet deployed, we give these proxies an empty contract as the initial implementation, to act as if they have no code.
*/
emptyContract = new EmptyContract();
avsDirectory = AVSDirectory(
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), ""))
);
delegationManager = DelegationManager(
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), ""))
);
strategyManager = StrategyManager(
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), ""))
);
slasher = Slasher(
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), ""))
);
eigenPodManager = EigenPodManager(
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), ""))
);
delayedWithdrawalRouter = DelayedWithdrawalRouter(
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), ""))
);

// Deploy EigenPod Contracts
eigenPodImplementation = new EigenPod(
IETHPOSDeposit(ETHPOSDepositAddress),
delayedWithdrawalRouter,
eigenPodManager,
EIGENPOD_MAX_RESTAKED_BALANCE_GWEI_PER_VALIDATOR,
EIGENPOD_GENESIS_TIME
);

eigenPodBeacon = new UpgradeableBeacon(address(eigenPodImplementation));
avsDirectoryImplementation = new AVSDirectory(delegationManager);
delegationManagerImplementation = new DelegationManager(strategyManager, slasher, eigenPodManager);
strategyManagerImplementation = new StrategyManager(delegationManager, eigenPodManager, slasher);
slasherImplementation = new Slasher(strategyManager, delegationManager);
eigenPodManagerImplementation = new EigenPodManager(
IETHPOSDeposit(ETHPOSDepositAddress),
eigenPodBeacon,
strategyManager,
slasher,
delegationManager
);
delayedWithdrawalRouterImplementation = new DelayedWithdrawalRouter(eigenPodManager);

// Third, upgrade the proxy contracts to point to the implementations
IStrategy[] memory initializeStrategiesToSetDelayBlocks = new IStrategy[](0);
uint256[] memory initializeWithdrawalDelayBlocks = new uint256[](0);
// AVSDirectory
eigenLayerProxyAdmin.upgradeAndCall(
TransparentUpgradeableProxy(payable(address(avsDirectory))),
address(avsDirectoryImplementation),
abi.encodeWithSelector(
AVSDirectory.initialize.selector,
executorMultisig, // initialOwner
eigenLayerPauserReg,
AVS_DIRECTORY_INIT_PAUSED_STATUS
)
);
// DelegationManager
eigenLayerProxyAdmin.upgradeAndCall(
TransparentUpgradeableProxy(payable(address(delegationManager))),
address(delegationManagerImplementation),
abi.encodeWithSelector(
DelegationManager.initialize.selector,
executorMultisig, // initialOwner
eigenLayerPauserReg,
DELEGATION_MANAGER_INIT_PAUSED_STATUS,
DELEGATION_MANAGER_MIN_WITHDRAWAL_DELAY_BLOCKS,
initializeStrategiesToSetDelayBlocks,
initializeWithdrawalDelayBlocks
)
);
// StrategyManager
eigenLayerProxyAdmin.upgradeAndCall(
TransparentUpgradeableProxy(payable(address(strategyManager))),
address(strategyManagerImplementation),
abi.encodeWithSelector(
StrategyManager.initialize.selector,
executorMultisig, //initialOwner
STRATEGY_MANAGER_WHITELISTER, //initial whitelister
eigenLayerPauserReg,
STRATEGY_MANAGER_INIT_PAUSED_STATUS
)
);
// Slasher
eigenLayerProxyAdmin.upgradeAndCall(
TransparentUpgradeableProxy(payable(address(slasher))),
address(slasherImplementation),
abi.encodeWithSelector(
Slasher.initialize.selector,
executorMultisig,
eigenLayerPauserReg,
SLASHER_INIT_PAUSED_STATUS
)
);
// EigenPodManager
eigenLayerProxyAdmin.upgradeAndCall(
TransparentUpgradeableProxy(payable(address(eigenPodManager))),
address(eigenPodManagerImplementation),
abi.encodeWithSelector(
EigenPodManager.initialize.selector,
beaconOracle,
msg.sender, // initialOwner is msg.sender for now to set forktimestamp later
eigenLayerPauserReg,
EIGENPOD_MANAGER_INIT_PAUSED_STATUS
)
);
// Delayed Withdrawal Router
eigenLayerProxyAdmin.upgradeAndCall(
TransparentUpgradeableProxy(payable(address(delayedWithdrawalRouter))),
address(delayedWithdrawalRouterImplementation),
abi.encodeWithSelector(
DelayedWithdrawalRouter.initialize.selector,
executorMultisig, // initialOwner
eigenLayerPauserReg,
DELAYED_WITHDRAWAL_ROUTER_INIT_PAUSED_STATUS,
DELAYED_WITHDRAWAL_ROUTER_INIT_WITHDRAWAL_DELAY_BLOCKS
)
);

// Deploy Strategies
baseStrategyImplementation = new StrategyBaseTVLLimits(strategyManager);
uint256 numStrategiesToDeploy = strategiesToDeploy.length;
for (uint256 i = 0; i < numStrategiesToDeploy; i++) {
StrategyUnderlyingTokenConfig memory strategyConfig = strategiesToDeploy[i];

// Deploy and upgrade strategy
StrategyBaseTVLLimits strategy = StrategyBaseTVLLimits(
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), ""))
);
eigenLayerProxyAdmin.upgradeAndCall(
TransparentUpgradeableProxy(payable(address(strategy))),
address(baseStrategyImplementation),
abi.encodeWithSelector(
StrategyBaseTVLLimits.initialize.selector,
STRATEGY_MAX_PER_DEPOSIT,
STRATEGY_MAX_TOTAL_DEPOSITS,
IERC20(strategyConfig.tokenAddress),
eigenLayerPauserReg
)
);

deployedStrategyArray.push(strategy);
}

// Fork timestamp config
eigenPodManager.setDenebForkTimestamp(EIGENPOD_MANAGER_DENEB_FORK_TIMESTAMP);

// Transfer ownership
eigenLayerProxyAdmin.transferOwnership(executorMultisig);
eigenPodManager.transferOwnership(executorMultisig);
eigenPodBeacon.transferOwnership(executorMultisig);
}
}
50 changes: 50 additions & 0 deletions script/deploy/holesky/M2_Deploy_Preprod.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.12;

import "./M2_Deploy_From_Scratch.s.sol";

/**
* @notice Script used for the first deployment of EigenLayer core contracts to Holesky
* forge script script/deploy/holesky/M2_Deploy_Preprod.s.sol --rpc-url http://127.0.0.1:8545 --private-key $PRIVATE_KEY --broadcast -vvvv
* forge script script/deploy/holesky/M2_Deploy_Preprod.s.sol --rpc-url $RPC_HOLESKY --private-key $PRIVATE_KEY --broadcast -vvvv
*
* Script for dev environment, exact same as M2_Deploy_From_Scratch.s.sol but with an EOAowner
* instead of multisig addresses for permissions.
* Unused config fields:
* - init_strategy_whitelister
* - multisig_addresses(operations, pauser, executor, community)
*/
contract M2_Deploy_Holesky_Preprod is M2_Deploy_Holesky_From_Scratch {
/// @dev EOAowner is the deployer and owner of the contracts
address EOAowner;

function run() external virtual override {
_parseInitialDeploymentParams("script/configs/holesky/M2_deploy_preprod.holesky.config.json");

// Overwrite multisig to be EOAowner
EOAowner = msg.sender;
executorMultisig = EOAowner;
operationsMultisig = EOAowner;
pauserMultisig = EOAowner;
communityMultisig = EOAowner;
STRATEGY_MANAGER_WHITELISTER = EOAowner;

// START RECORDING TRANSACTIONS FOR DEPLOYMENT
vm.startBroadcast();

emit log_named_address("Deployer and EOAowner Address", EOAowner);

_deployFromScratch();

// STOP RECORDING TRANSACTIONS FOR DEPLOYMENT
vm.stopBroadcast();

// Sanity Checks
_verifyContractPointers();
_verifyImplementations();
_verifyContractsInitialized({isInitialDeployment: true});
_verifyInitializationParams(); // override to check contract.owner() is EOAowner instead

logAndOutputContractAddresses("script/output/holesky/M2_deploy_preprod.holesky.config.json");
}
}
Loading

0 comments on commit 43ffb52

Please sign in to comment.