From f7ec3d4b8920b0adc54514115bf9c1e864d9380b Mon Sep 17 00:00:00 2001 From: 8sunyuan Date: Thu, 22 Feb 2024 06:25:46 -0500 Subject: [PATCH 1/3] chore: spring cleaning --- script/BecomeOperator.s.sol | 22 -- script/DepositAndDelegate.s.sol | 37 --- script/EigenLayerParser.sol | 48 ---- script/M1_deploy.config.json | 62 ----- script/configs/AVSContractsDeploy.json | 34 --- .../{ => devnet}/M1_deploy_devnet.config.json | 0 .../M2_deploy_from_scratch.anvil.config.json | 0 .../{ => goerli}/M1_deploy_goerli.config.json | 0 .../M1_deploy_mainnet.config.json | 0 ...M2_deploy_from_scratch.mainnet.config.json | 0 .../M2_Deploy_From_Scratch.s.sol | 26 +- .../goerli}/GoerliUpgrade1.s.sol | 18 +- .../goerli}/GoerliUpgrade2.s.sol | 18 +- script/{ => deploy/mainnet}/M1_Deploy.s.sol | 24 +- .../mainnet}/M2Deploy.s.sol | 18 +- script/middleware/DeployOpenEigenLayer.s.sol | 225 ------------------ .../{ => devnet}/M1_MOCK_deployment_data.json | 0 .../M2_from_scratch_deployment_data.json | 0 .../{ => goerli}/GV2_deployment_2024_6_2.json | 0 .../GV2_preprod_deployment_2024_30_1.json | 0 .../M1_deployment_goerli_2023_3_23.json | 0 .../M2_deployment_data_goerli.json | 0 .../M2_preprod_deployment_from_scratch.json | 0 .../{ => goerli}/deployment_output.json | 0 .../M1_deployment_mainnet_2023_6_9.json | 0 .../validateStorage}/README.md | 0 .../validateStorage}/validateStorage.ts | 0 .../validateStorage}/validateUpgrade.sh | 0 28 files changed, 52 insertions(+), 480 deletions(-) delete mode 100644 script/BecomeOperator.s.sol delete mode 100644 script/DepositAndDelegate.s.sol delete mode 100644 script/EigenLayerParser.sol delete mode 100644 script/M1_deploy.config.json delete mode 100644 script/configs/AVSContractsDeploy.json rename script/configs/{ => devnet}/M1_deploy_devnet.config.json (100%) rename script/{testing => configs/devnet}/M2_deploy_from_scratch.anvil.config.json (100%) rename script/configs/{ => goerli}/M1_deploy_goerli.config.json (100%) rename script/configs/{ => mainnet}/M1_deploy_mainnet.config.json (100%) rename script/{testing => configs/mainnet}/M2_deploy_from_scratch.mainnet.config.json (100%) rename script/{testing => deploy}/M2_Deploy_From_Scratch.s.sol (97%) rename script/{upgrade => deploy/goerli}/GoerliUpgrade1.s.sol (85%) rename script/{upgrade => deploy/goerli}/GoerliUpgrade2.s.sol (90%) rename script/{ => deploy/mainnet}/M1_Deploy.s.sol (97%) rename script/{milestone => deploy/mainnet}/M2Deploy.s.sol (98%) delete mode 100644 script/middleware/DeployOpenEigenLayer.s.sol rename script/output/{ => devnet}/M1_MOCK_deployment_data.json (100%) rename script/output/{ => devnet}/M2_from_scratch_deployment_data.json (100%) rename script/output/{ => goerli}/GV2_deployment_2024_6_2.json (100%) rename script/output/{ => goerli}/GV2_preprod_deployment_2024_30_1.json (100%) rename script/output/{ => goerli}/M1_deployment_goerli_2023_3_23.json (100%) rename script/output/{ => goerli}/M2_deployment_data_goerli.json (100%) rename script/output/{ => goerli}/M2_preprod_deployment_from_scratch.json (100%) rename script/output/{ => goerli}/deployment_output.json (100%) rename script/output/{ => mainnet}/M1_deployment_mainnet_2023_6_9.json (100%) rename script/{upgrade => utils/validateStorage}/README.md (100%) rename script/{upgrade => utils/validateStorage}/validateStorage.ts (100%) rename script/{upgrade => utils/validateStorage}/validateUpgrade.sh (100%) mode change 100755 => 100644 diff --git a/script/BecomeOperator.s.sol b/script/BecomeOperator.s.sol deleted file mode 100644 index b34661039..000000000 --- a/script/BecomeOperator.s.sol +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.12; - -import "./EigenLayerParser.sol"; - -contract BecomeOperator is Script, DSTest, EigenLayerParser { - //performs basic deployment before each test - function run() external { - IDelegationManager.OperatorDetails memory operatorDetails = IDelegationManager.OperatorDetails({ - earningsReceiver: msg.sender, - delegationApprover: address(0), - stakerOptOutWindowBlocks: 0 - }); - parseEigenLayerParams(); - vm.broadcast(msg.sender); - string memory emptyStringForMetadataURI; - delegation.registerAsOperator(operatorDetails, emptyStringForMetadataURI); - } -} - - - diff --git a/script/DepositAndDelegate.s.sol b/script/DepositAndDelegate.s.sol deleted file mode 100644 index 95a53a366..000000000 --- a/script/DepositAndDelegate.s.sol +++ /dev/null @@ -1,37 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.12; - -import "./EigenLayerParser.sol"; -import "../src/contracts/interfaces/ISignatureUtils.sol"; - -contract DepositAndDelegate is Script, DSTest, EigenLayerParser { - - //performs basic deployment before each test - function run() external { - parseEigenLayerParams(); - - uint256 wethAmount = eigenTotalSupply / (numStaker + numDis + 50); // save 100 portions - - address dlnAddr; - - //get the corresponding dln - //is there an easier way to do this? - for (uint256 i = 0; i < numStaker; i++) { - address stakerAddr = - stdJson.readAddress(configJson, string.concat(".staker[", string.concat(vm.toString(i), "].address"))); - if (stakerAddr == msg.sender) { - dlnAddr = - stdJson.readAddress(configJson, string.concat(".dln[", string.concat(vm.toString(i), "].address"))); - } - } - - vm.startBroadcast(msg.sender); - eigen.approve(address(strategyManager), wethAmount); - strategyManager.depositIntoStrategy(eigenStrat, eigen, wethAmount); - weth.approve(address(strategyManager), wethAmount); - strategyManager.depositIntoStrategy(wethStrat, weth, wethAmount); - ISignatureUtils.SignatureWithExpiry memory signatureWithExpiry; - delegation.delegateTo(dlnAddr, signatureWithExpiry, bytes32(0)); - vm.stopBroadcast(); - } -} diff --git a/script/EigenLayerParser.sol b/script/EigenLayerParser.sol deleted file mode 100644 index 833cf33df..000000000 --- a/script/EigenLayerParser.sol +++ /dev/null @@ -1,48 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.12; - -import "../src/contracts/interfaces/IDelegationManager.sol"; -import "../src/contracts/core/DelegationManager.sol"; - -import "../src/contracts/core/StrategyManager.sol"; -import "../src/contracts/strategies/StrategyBase.sol"; -import "../src/contracts/core/Slasher.sol"; - -import "forge-std/Test.sol"; -import "forge-std/Script.sol"; -import "forge-std/StdJson.sol"; - -contract EigenLayerParser is Script, DSTest { - Vm cheats = Vm(HEVM_ADDRESS); - - uint256 numDis; - uint256 numDln; - uint256 numStaker; - uint256 numCha; - - uint256 public constant eigenTotalSupply = 1000e18; - DelegationManager public delegation; - StrategyManager public strategyManager; - IERC20 public weth; - StrategyBase public wethStrat; - IERC20 public eigen; - StrategyBase public eigenStrat; - - string internal configJson; - string internal addressJson; - - function parseEigenLayerParams() internal { - configJson = vm.readFile("data/participants.json"); - numDis = stdJson.readUint(configJson, ".numDis"); - numDln = stdJson.readUint(configJson, ".numDln"); - numStaker = stdJson.readUint(configJson, ".numStaker"); - - addressJson = vm.readFile("data/addresses.json"); - delegation = DelegationManager(stdJson.readAddress(addressJson, ".delegation")); - strategyManager = StrategyManager(stdJson.readAddress(addressJson, ".strategyManager")); - weth = IERC20(stdJson.readAddress(addressJson, ".weth")); - wethStrat = StrategyBase(stdJson.readAddress(addressJson, ".wethStrat")); - eigen = IERC20(stdJson.readAddress(addressJson, ".eigen")); - eigenStrat = StrategyBase(stdJson.readAddress(addressJson, ".eigenStrat")); - } -} diff --git a/script/M1_deploy.config.json b/script/M1_deploy.config.json deleted file mode 100644 index 008610091..000000000 --- a/script/M1_deploy.config.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "multisig_addresses": { - "communityMultisig": "", - "operationsMultisig": "0xBE1685C81aA44FF9FB319dD389addd9374383e90", - "pauserMultisig": "0x5050389572f2d220ad927CcbeA0D406831012390", - "executorMultisig": "0xBE1685C81aA44FF9FB319dD389addd9374383e90", - "timelock": "" - }, - "strategies": [ - { - "token_address": "0xBe9895146f7AF43049ca1c1AE358B0541Ea49704", - "token_name": "Coinbase Wrapped Staked ETH", - "token_symbol": "cbETH", - "max_per_deposit": 0, - "max_deposits": 0 - }, - { - "token_address": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84", - "token_name": "Liquid staked Ether 2.0", - "token_symbol": "stETH", - "max_per_deposit": 0, - "max_deposits": 0 - }, - { - "token_address": "0xae78736Cd615f374D3085123A210448E74Fc6393", - "token_name": "Rocket Pool ETH", - "token_symbol": "rETH", - "max_per_deposit": 0, - "max_deposits": 0 - } - ], - "strategyManager": - { - "init_paused_status": 0, - "init_withdrawal_delay_blocks": 50400 - }, - "eigenPod": - { - "PARTIAL_WITHDRAWAL_FRAUD_PROOF_PERIOD_BLOCKS": 50400, - "REQUIRED_BALANCE_WEI": "31000000000000000000", - "MAX_RESTAKED_BALANCE_GWEI_PER_VALIDATOR": "31000000000" - }, - "eigenPodManager": - { - "max_pods": 0, - "init_paused_status": 30 - }, - "delayedWithdrawalRouter": - { - "init_paused_status": 0, - "init_withdrawal_delay_blocks": 50400 - }, - "slasher": - { - "init_paused_status": "115792089237316195423570985008687907853269984665640564039457584007913129639935" - }, - "delegation": - { - "init_paused_status": "115792089237316195423570985008687907853269984665640564039457584007913129639935" - }, - "ethPOSDepositAddress": "0x00000000219ab540356cBB839Cbe05303d7705Fa" - } \ No newline at end of file diff --git a/script/configs/AVSContractsDeploy.json b/script/configs/AVSContractsDeploy.json deleted file mode 100644 index e6e052c0e..000000000 --- a/script/configs/AVSContractsDeploy.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "multisig_addresses": { - "alphaMultisig": "0x95C7A3F90e80329C97A6493142Ab7923E15b8083" - }, - "strategyManager": - { - "init_paused_status": 0, - "init_withdrawal_delay_blocks": 10 - }, - "eigenPod": - { - "PARTIAL_WITHDRAWAL_FRAUD_PROOF_PERIOD_BLOCKS": 50400, - "REQUIRED_BALANCE_WEI": "32000000000000000000" - }, - "eigenPodManager": - { - "init_paused_status": 30, - "max_pods": 0 - }, - "delayedWithdrawalRouter": - { - "init_paused_status": 0, - "init_withdrawal_delay_blocks": 10 - }, - "slasher": - { - "init_paused_status": "0" - }, - "delegation": - { - "init_paused_status": "0" - }, - "ethPOSDepositAddress": "0xff50ed3d0ec03ac01d4c79aad74928bff48a7b2b" -} \ No newline at end of file diff --git a/script/configs/M1_deploy_devnet.config.json b/script/configs/devnet/M1_deploy_devnet.config.json similarity index 100% rename from script/configs/M1_deploy_devnet.config.json rename to script/configs/devnet/M1_deploy_devnet.config.json diff --git a/script/testing/M2_deploy_from_scratch.anvil.config.json b/script/configs/devnet/M2_deploy_from_scratch.anvil.config.json similarity index 100% rename from script/testing/M2_deploy_from_scratch.anvil.config.json rename to script/configs/devnet/M2_deploy_from_scratch.anvil.config.json diff --git a/script/configs/M1_deploy_goerli.config.json b/script/configs/goerli/M1_deploy_goerli.config.json similarity index 100% rename from script/configs/M1_deploy_goerli.config.json rename to script/configs/goerli/M1_deploy_goerli.config.json diff --git a/script/configs/M1_deploy_mainnet.config.json b/script/configs/mainnet/M1_deploy_mainnet.config.json similarity index 100% rename from script/configs/M1_deploy_mainnet.config.json rename to script/configs/mainnet/M1_deploy_mainnet.config.json diff --git a/script/testing/M2_deploy_from_scratch.mainnet.config.json b/script/configs/mainnet/M2_deploy_from_scratch.mainnet.config.json similarity index 100% rename from script/testing/M2_deploy_from_scratch.mainnet.config.json rename to script/configs/mainnet/M2_deploy_from_scratch.mainnet.config.json diff --git a/script/testing/M2_Deploy_From_Scratch.s.sol b/script/deploy/M2_Deploy_From_Scratch.s.sol similarity index 97% rename from script/testing/M2_Deploy_From_Scratch.s.sol rename to script/deploy/M2_Deploy_From_Scratch.s.sol index 1eea0af3d..53d0d90e7 100644 --- a/script/testing/M2_Deploy_From_Scratch.s.sol +++ b/script/deploy/M2_Deploy_From_Scratch.s.sol @@ -6,24 +6,24 @@ import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; import "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol"; -import "../../src/contracts/interfaces/IETHPOSDeposit.sol"; -import "../../src/contracts/interfaces/IBeaconChainOracle.sol"; +import "src/contracts/interfaces/IETHPOSDeposit.sol"; +import "src/contracts/interfaces/IBeaconChainOracle.sol"; -import "../../src/contracts/core/StrategyManager.sol"; -import "../../src/contracts/core/Slasher.sol"; -import "../../src/contracts/core/DelegationManager.sol"; -import "../../src/contracts/core/AVSDirectory.sol"; +import "src/contracts/core/StrategyManager.sol"; +import "src/contracts/core/Slasher.sol"; +import "src/contracts/core/DelegationManager.sol"; +import "src/contracts/core/AVSDirectory.sol"; -import "../../src/contracts/strategies/StrategyBaseTVLLimits.sol"; +import "src/contracts/strategies/StrategyBaseTVLLimits.sol"; -import "../../src/contracts/pods/EigenPod.sol"; -import "../../src/contracts/pods/EigenPodManager.sol"; -import "../../src/contracts/pods/DelayedWithdrawalRouter.sol"; +import "src/contracts/pods/EigenPod.sol"; +import "src/contracts/pods/EigenPodManager.sol"; +import "src/contracts/pods/DelayedWithdrawalRouter.sol"; -import "../../src/contracts/permissions/PauserRegistry.sol"; +import "src/contracts/permissions/PauserRegistry.sol"; -import "../../src/test/mocks/EmptyContract.sol"; -import "../../src/test/mocks/ETHDepositMock.sol"; +import "src/test/mocks/EmptyContract.sol"; +import "src/test/mocks/ETHDepositMock.sol"; import "forge-std/Script.sol"; import "forge-std/Test.sol"; diff --git a/script/upgrade/GoerliUpgrade1.s.sol b/script/deploy/goerli/GoerliUpgrade1.s.sol similarity index 85% rename from script/upgrade/GoerliUpgrade1.s.sol rename to script/deploy/goerli/GoerliUpgrade1.s.sol index 5d645a25b..6a1cd2d0c 100644 --- a/script/upgrade/GoerliUpgrade1.s.sol +++ b/script/deploy/goerli/GoerliUpgrade1.s.sol @@ -4,18 +4,18 @@ pragma solidity =0.8.12; import "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol"; -import "../../src/contracts/interfaces/IETHPOSDeposit.sol"; -import "../../src/contracts/interfaces/IBeaconChainOracle.sol"; +import "src/contracts/interfaces/IETHPOSDeposit.sol"; +import "src/contracts/interfaces/IBeaconChainOracle.sol"; -import "../../src/contracts/core/StrategyManager.sol"; -import "../../src/contracts/core/Slasher.sol"; -import "../../src/contracts/core/DelegationManager.sol"; +import "src/contracts/core/StrategyManager.sol"; +import "src/contracts/core/Slasher.sol"; +import "src/contracts/core/DelegationManager.sol"; -import "../../src/contracts/strategies/StrategyBase.sol"; +import "src/contracts/strategies/StrategyBase.sol"; -import "../../src/contracts/pods/EigenPod.sol"; -import "../../src/contracts/pods/EigenPodManager.sol"; -import "../../src/contracts/pods/DelayedWithdrawalRouter.sol"; +import "src/contracts/pods/EigenPod.sol"; +import "src/contracts/pods/EigenPodManager.sol"; +import "src/contracts/pods/DelayedWithdrawalRouter.sol"; import "forge-std/Script.sol"; diff --git a/script/upgrade/GoerliUpgrade2.s.sol b/script/deploy/goerli/GoerliUpgrade2.s.sol similarity index 90% rename from script/upgrade/GoerliUpgrade2.s.sol rename to script/deploy/goerli/GoerliUpgrade2.s.sol index 1e83b4522..0c204b626 100644 --- a/script/upgrade/GoerliUpgrade2.s.sol +++ b/script/deploy/goerli/GoerliUpgrade2.s.sol @@ -1,19 +1,19 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity =0.8.12; -import "../../src/contracts/interfaces/IETHPOSDeposit.sol"; +import "src/contracts/interfaces/IETHPOSDeposit.sol"; -import "../../src/contracts/core/StrategyManager.sol"; -import "../../src/contracts/core/Slasher.sol"; -import "../../src/contracts/core/DelegationManager.sol"; -import "../../src/contracts/core/AVSDirectory.sol"; +import "src/contracts/core/StrategyManager.sol"; +import "src/contracts/core/Slasher.sol"; +import "src/contracts/core/DelegationManager.sol"; +import "src/contracts/core/AVSDirectory.sol"; -import "../../src/contracts/pods/EigenPod.sol"; -import "../../src/contracts/pods/EigenPodManager.sol"; -import "../../src/contracts/pods/DelayedWithdrawalRouter.sol"; +import "src/contracts/pods/EigenPod.sol"; +import "src/contracts/pods/EigenPodManager.sol"; +import "src/contracts/pods/DelayedWithdrawalRouter.sol"; import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; -import "../../src/test/mocks/EmptyContract.sol"; +import "src/test/mocks/EmptyContract.sol"; import "forge-std/Script.sol"; import "forge-std/Test.sol"; diff --git a/script/M1_Deploy.s.sol b/script/deploy/mainnet/M1_Deploy.s.sol similarity index 97% rename from script/M1_Deploy.s.sol rename to script/deploy/mainnet/M1_Deploy.s.sol index a1aebb11d..a713c8d07 100644 --- a/script/M1_Deploy.s.sol +++ b/script/deploy/mainnet/M1_Deploy.s.sol @@ -6,23 +6,23 @@ import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; import "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol"; -import "../src/contracts/interfaces/IETHPOSDeposit.sol"; -import "../src/contracts/interfaces/IBeaconChainOracle.sol"; +import "src/contracts/interfaces/IETHPOSDeposit.sol"; +import "src/contracts/interfaces/IBeaconChainOracle.sol"; -import "../src/contracts/core/StrategyManager.sol"; -import "../src/contracts/core/Slasher.sol"; -import "../src/contracts/core/DelegationManager.sol"; +import "src/contracts/core/StrategyManager.sol"; +import "src/contracts/core/Slasher.sol"; +import "src/contracts/core/DelegationManager.sol"; -import "../src/contracts/strategies/StrategyBaseTVLLimits.sol"; +import "src/contracts/strategies/StrategyBaseTVLLimits.sol"; -import "../src/contracts/pods/EigenPod.sol"; -import "../src/contracts/pods/EigenPodManager.sol"; -import "../src/contracts/pods/DelayedWithdrawalRouter.sol"; +import "src/contracts/pods/EigenPod.sol"; +import "src/contracts/pods/EigenPodManager.sol"; +import "src/contracts/pods/DelayedWithdrawalRouter.sol"; -import "../src/contracts/permissions/PauserRegistry.sol"; +import "src/contracts/permissions/PauserRegistry.sol"; -import "../src/test/mocks/EmptyContract.sol"; -import "../src/test/mocks/ETHDepositMock.sol"; +import "src/test/mocks/EmptyContract.sol"; +import "src/test/mocks/ETHDepositMock.sol"; import "forge-std/Script.sol"; import "forge-std/Test.sol"; diff --git a/script/milestone/M2Deploy.s.sol b/script/deploy/mainnet/M2Deploy.s.sol similarity index 98% rename from script/milestone/M2Deploy.s.sol rename to script/deploy/mainnet/M2Deploy.s.sol index fb9db6c72..d48e518e0 100644 --- a/script/milestone/M2Deploy.s.sol +++ b/script/deploy/mainnet/M2Deploy.s.sol @@ -6,18 +6,18 @@ import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; import "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol"; -import "../../src/contracts/interfaces/IETHPOSDeposit.sol"; -import "../../src/contracts/interfaces/IBeaconChainOracle.sol"; +import "src/contracts/interfaces/IETHPOSDeposit.sol"; +import "src/contracts/interfaces/IBeaconChainOracle.sol"; -import "../../src/contracts/core/StrategyManager.sol"; -import "../../src/contracts/core/Slasher.sol"; -import "../../src/contracts/core/DelegationManager.sol"; +import "src/contracts/core/StrategyManager.sol"; +import "src/contracts/core/Slasher.sol"; +import "src/contracts/core/DelegationManager.sol"; -import "../../src/contracts/pods/EigenPod.sol"; -import "../../src/contracts/pods/EigenPodManager.sol"; -import "../../src/contracts/pods/DelayedWithdrawalRouter.sol"; +import "src/contracts/pods/EigenPod.sol"; +import "src/contracts/pods/EigenPodManager.sol"; +import "src/contracts/pods/DelayedWithdrawalRouter.sol"; -import "../../src/contracts/permissions/PauserRegistry.sol"; +import "src/contracts/permissions/PauserRegistry.sol"; import "forge-std/Script.sol"; import "forge-std/Test.sol"; diff --git a/script/middleware/DeployOpenEigenLayer.s.sol b/script/middleware/DeployOpenEigenLayer.s.sol deleted file mode 100644 index 46381f8c5..000000000 --- a/script/middleware/DeployOpenEigenLayer.s.sol +++ /dev/null @@ -1,225 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.12; - -import "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol"; -import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; -import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; -import "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol"; - -import "../../src/contracts/interfaces/IETHPOSDeposit.sol"; -import "../../src/contracts/interfaces/IBeaconChainOracle.sol"; - -import "../../src/contracts/core/StrategyManager.sol"; -import "../../src/contracts/core/Slasher.sol"; -import "../../src/contracts/core/DelegationManager.sol"; -import "../../src/contracts/core/AVSDirectory.sol"; - -import "../../src/contracts/strategies/StrategyBaseTVLLimits.sol"; - -import "../../src/contracts/pods/EigenPod.sol"; -import "../../src/contracts/pods/EigenPodManager.sol"; -import "../../src/contracts/pods/DelayedWithdrawalRouter.sol"; - -import "../../src/contracts/permissions/PauserRegistry.sol"; - -import "../../src/test/mocks/EmptyContract.sol"; -import "../../src/test/mocks/ETHDepositMock.sol"; - -import "forge-std/Script.sol"; -import "forge-std/Test.sol"; - -// # To load the variables in the .env file -// source .env - -// # To deploy and verify our contract -// forge script script/M1_Deploy.s.sol:Deployer_M1 --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast -vvvv -contract DeployOpenEigenLayer is Script, Test { - Vm cheats = Vm(HEVM_ADDRESS); - - // struct used to encode token info in config file - struct StrategyConfig { - uint256 maxDeposits; - uint256 maxPerDeposit; - address tokenAddress; - string tokenSymbol; - } - - // EigenLayer Contracts - ProxyAdmin public eigenLayerProxyAdmin; - PauserRegistry public eigenLayerPauserReg; - Slasher public slasher; - Slasher public slasherImplementation; - DelegationManager public delegation; - DelegationManager public delegationImplementation; - StrategyManager public strategyManager; - StrategyManager public strategyManagerImplementation; - EigenPodManager public eigenPodManager; - EigenPodManager public eigenPodManagerImplementation; - DelayedWithdrawalRouter public delayedWithdrawalRouter; - DelayedWithdrawalRouter public delayedWithdrawalRouterImplementation; - AVSDirectory public avsDirectory; - AVSDirectory public avsDirectoryImplementation; - UpgradeableBeacon public eigenPodBeacon; - EigenPod public eigenPodImplementation; - StrategyBase public baseStrategyImplementation; - - EmptyContract public emptyContract; - - // the ETH2 deposit contract -- if not on mainnet, we deploy a mock as stand-in - IETHPOSDeposit public ethPOSDeposit; - - // strategies deployed - StrategyBaseTVLLimits[] public deployedStrategyArray; - - function _deployEigenLayer( - address executorMultisig, - address operationsMultisig, - address pauserMultisig, - StrategyConfig[] memory strategyConfigs - ) internal { - require(executorMultisig != address(0), "executorMultisig address not configured correctly!"); - require(operationsMultisig != address(0), "operationsMultisig address not configured correctly!"); - - // deploy proxy admin for the ability to upgrade proxy contracts - eigenLayerProxyAdmin = new ProxyAdmin(); - - //deploy pauser registry - { - address[] memory pausers = new address[](3); - pausers[0] = executorMultisig; - pausers[1] = operationsMultisig; - pausers[2] = pauserMultisig; - eigenLayerPauserReg = new PauserRegistry(pausers, executorMultisig); - } - - /** - * 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(); - delegation = DelegationManager( - address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), "")) - ); - avsDirectory = AVSDirectory( - 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), "")) - ); - - // ETH POS deposit is 0 address - eigenPodImplementation = new EigenPod( - ethPOSDeposit, - delayedWithdrawalRouter, - eigenPodManager, - // uint64(MAX_VALIDATOR_BALANCE_GWEI), - uint64(32 gwei), - 1000 // temp genesis time - ); - - eigenPodBeacon = new UpgradeableBeacon(address(eigenPodImplementation)); - - // Second, deploy the *implementation* contracts, using the *proxy contracts* as inputs - delegationImplementation = new DelegationManager(strategyManager, slasher, eigenPodManager); - avsDirectoryImplementation = new AVSDirectory(delegation); - strategyManagerImplementation = new StrategyManager(delegation, eigenPodManager, slasher); - slasherImplementation = new Slasher(strategyManager, delegation); - eigenPodManagerImplementation = new EigenPodManager( - ethPOSDeposit, - eigenPodBeacon, - strategyManager, - slasher, - delegation - ); - delayedWithdrawalRouterImplementation = new DelayedWithdrawalRouter(eigenPodManager); - - // Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them. - IStrategy[] memory _strategies; - uint256[] memory _withdrawalDelayBlocks; - eigenLayerProxyAdmin.upgradeAndCall( - TransparentUpgradeableProxy(payable(address(delegation))), - address(delegationImplementation), - abi.encodeWithSelector(DelegationManager.initialize.selector, executorMultisig, eigenLayerPauserReg, 0, 0, _strategies, _withdrawalDelayBlocks) - ); - eigenLayerProxyAdmin.upgradeAndCall( - TransparentUpgradeableProxy(payable(address(avsDirectory))), - address(avsDirectoryImplementation), - abi.encodeWithSelector(AVSDirectory.initialize.selector, executorMultisig, eigenLayerPauserReg, 0) - ); - eigenLayerProxyAdmin.upgradeAndCall( - TransparentUpgradeableProxy(payable(address(strategyManager))), - address(strategyManagerImplementation), - abi.encodeWithSelector( - StrategyManager.initialize.selector, - executorMultisig, - operationsMultisig, - eigenLayerPauserReg, - 0, - 0 - ) - ); - eigenLayerProxyAdmin.upgradeAndCall( - TransparentUpgradeableProxy(payable(address(slasher))), - address(slasherImplementation), - abi.encodeWithSelector(Slasher.initialize.selector, executorMultisig, eigenLayerPauserReg, 0) - ); - eigenLayerProxyAdmin.upgradeAndCall( - TransparentUpgradeableProxy(payable(address(eigenPodManager))), - address(eigenPodManagerImplementation), - abi.encodeWithSelector( - EigenPodManager.initialize.selector, - type(uint256).max, - IBeaconChainOracle(address(0)), - executorMultisig, - eigenLayerPauserReg, - 0 - ) - ); - eigenLayerProxyAdmin.upgradeAndCall( - TransparentUpgradeableProxy(payable(address(delayedWithdrawalRouter))), - address(delayedWithdrawalRouterImplementation), - abi.encodeWithSelector( - DelayedWithdrawalRouter.initialize.selector, - executorMultisig, - eigenLayerPauserReg, - 0, - 0 - ) - ); - - // deploy StrategyBaseTVLLimits contract implementation - baseStrategyImplementation = new StrategyBaseTVLLimits(strategyManager); - // create upgradeable proxies that each point to the implementation and initialize them - for (uint256 i = 0; i < strategyConfigs.length; ++i) { - deployedStrategyArray.push( - StrategyBaseTVLLimits( - address( - new TransparentUpgradeableProxy( - address(baseStrategyImplementation), - address(eigenLayerProxyAdmin), - abi.encodeWithSelector( - StrategyBaseTVLLimits.initialize.selector, - strategyConfigs[i].maxPerDeposit, - strategyConfigs[i].maxDeposits, - IERC20(strategyConfigs[i].tokenAddress), - eigenLayerPauserReg - ) - ) - ) - ) - ); - } - - eigenLayerProxyAdmin.transferOwnership(executorMultisig); - eigenPodBeacon.transferOwnership(executorMultisig); - } -} diff --git a/script/output/M1_MOCK_deployment_data.json b/script/output/devnet/M1_MOCK_deployment_data.json similarity index 100% rename from script/output/M1_MOCK_deployment_data.json rename to script/output/devnet/M1_MOCK_deployment_data.json diff --git a/script/output/M2_from_scratch_deployment_data.json b/script/output/devnet/M2_from_scratch_deployment_data.json similarity index 100% rename from script/output/M2_from_scratch_deployment_data.json rename to script/output/devnet/M2_from_scratch_deployment_data.json diff --git a/script/output/GV2_deployment_2024_6_2.json b/script/output/goerli/GV2_deployment_2024_6_2.json similarity index 100% rename from script/output/GV2_deployment_2024_6_2.json rename to script/output/goerli/GV2_deployment_2024_6_2.json diff --git a/script/output/GV2_preprod_deployment_2024_30_1.json b/script/output/goerli/GV2_preprod_deployment_2024_30_1.json similarity index 100% rename from script/output/GV2_preprod_deployment_2024_30_1.json rename to script/output/goerli/GV2_preprod_deployment_2024_30_1.json diff --git a/script/output/M1_deployment_goerli_2023_3_23.json b/script/output/goerli/M1_deployment_goerli_2023_3_23.json similarity index 100% rename from script/output/M1_deployment_goerli_2023_3_23.json rename to script/output/goerli/M1_deployment_goerli_2023_3_23.json diff --git a/script/output/M2_deployment_data_goerli.json b/script/output/goerli/M2_deployment_data_goerli.json similarity index 100% rename from script/output/M2_deployment_data_goerli.json rename to script/output/goerli/M2_deployment_data_goerli.json diff --git a/script/output/M2_preprod_deployment_from_scratch.json b/script/output/goerli/M2_preprod_deployment_from_scratch.json similarity index 100% rename from script/output/M2_preprod_deployment_from_scratch.json rename to script/output/goerli/M2_preprod_deployment_from_scratch.json diff --git a/script/output/deployment_output.json b/script/output/goerli/deployment_output.json similarity index 100% rename from script/output/deployment_output.json rename to script/output/goerli/deployment_output.json diff --git a/script/output/M1_deployment_mainnet_2023_6_9.json b/script/output/mainnet/M1_deployment_mainnet_2023_6_9.json similarity index 100% rename from script/output/M1_deployment_mainnet_2023_6_9.json rename to script/output/mainnet/M1_deployment_mainnet_2023_6_9.json diff --git a/script/upgrade/README.md b/script/utils/validateStorage/README.md similarity index 100% rename from script/upgrade/README.md rename to script/utils/validateStorage/README.md diff --git a/script/upgrade/validateStorage.ts b/script/utils/validateStorage/validateStorage.ts similarity index 100% rename from script/upgrade/validateStorage.ts rename to script/utils/validateStorage/validateStorage.ts diff --git a/script/upgrade/validateUpgrade.sh b/script/utils/validateStorage/validateUpgrade.sh old mode 100755 new mode 100644 similarity index 100% rename from script/upgrade/validateUpgrade.sh rename to script/utils/validateStorage/validateUpgrade.sh From ed96feb9e7e6255539afa75aa74e257ac25d9fb3 Mon Sep 17 00:00:00 2001 From: 8sunyuan Date: Thu, 22 Feb 2024 09:53:02 -0500 Subject: [PATCH 2/3] fix: test deployment path --- src/test/EigenLayerDeployer.t.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/EigenLayerDeployer.t.sol b/src/test/EigenLayerDeployer.t.sol index 05998820f..ac28592d2 100644 --- a/src/test/EigenLayerDeployer.t.sol +++ b/src/test/EigenLayerDeployer.t.sol @@ -107,7 +107,7 @@ contract EigenLayerDeployer is Operators { uint256 public initialBeaconChainOracleThreshold = 3; - string internal goerliDeploymentConfig = vm.readFile("script/output/M1_deployment_goerli_2023_3_23.json"); + string internal goerliDeploymentConfig = vm.readFile("script/output/goerli/M1_deployment_goerli_2023_3_23.json"); // addresses excluded from fuzzing due to abnormal behavior. TODO: @Sidu28 define this better and give it a clearer name mapping(address => bool) fuzzedAddressMapping; From 727cac8388d6be110c8d41287052958cc090d8ba Mon Sep 17 00:00:00 2001 From: 8sunyuan Date: Mon, 26 Feb 2024 14:15:20 -0500 Subject: [PATCH 3/3] chore: revert back to relative paths --- script/deploy/M2_Deploy_From_Scratch.s.sol | 26 +++++++++++----------- script/deploy/goerli/GoerliUpgrade1.s.sol | 18 +++++++-------- script/deploy/goerli/GoerliUpgrade2.s.sol | 18 +++++++-------- script/deploy/mainnet/M1_Deploy.s.sol | 24 ++++++++++---------- script/deploy/mainnet/M2Deploy.s.sol | 18 +++++++-------- 5 files changed, 52 insertions(+), 52 deletions(-) diff --git a/script/deploy/M2_Deploy_From_Scratch.s.sol b/script/deploy/M2_Deploy_From_Scratch.s.sol index 53d0d90e7..1eea0af3d 100644 --- a/script/deploy/M2_Deploy_From_Scratch.s.sol +++ b/script/deploy/M2_Deploy_From_Scratch.s.sol @@ -6,24 +6,24 @@ import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; import "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol"; -import "src/contracts/interfaces/IETHPOSDeposit.sol"; -import "src/contracts/interfaces/IBeaconChainOracle.sol"; +import "../../src/contracts/interfaces/IETHPOSDeposit.sol"; +import "../../src/contracts/interfaces/IBeaconChainOracle.sol"; -import "src/contracts/core/StrategyManager.sol"; -import "src/contracts/core/Slasher.sol"; -import "src/contracts/core/DelegationManager.sol"; -import "src/contracts/core/AVSDirectory.sol"; +import "../../src/contracts/core/StrategyManager.sol"; +import "../../src/contracts/core/Slasher.sol"; +import "../../src/contracts/core/DelegationManager.sol"; +import "../../src/contracts/core/AVSDirectory.sol"; -import "src/contracts/strategies/StrategyBaseTVLLimits.sol"; +import "../../src/contracts/strategies/StrategyBaseTVLLimits.sol"; -import "src/contracts/pods/EigenPod.sol"; -import "src/contracts/pods/EigenPodManager.sol"; -import "src/contracts/pods/DelayedWithdrawalRouter.sol"; +import "../../src/contracts/pods/EigenPod.sol"; +import "../../src/contracts/pods/EigenPodManager.sol"; +import "../../src/contracts/pods/DelayedWithdrawalRouter.sol"; -import "src/contracts/permissions/PauserRegistry.sol"; +import "../../src/contracts/permissions/PauserRegistry.sol"; -import "src/test/mocks/EmptyContract.sol"; -import "src/test/mocks/ETHDepositMock.sol"; +import "../../src/test/mocks/EmptyContract.sol"; +import "../../src/test/mocks/ETHDepositMock.sol"; import "forge-std/Script.sol"; import "forge-std/Test.sol"; diff --git a/script/deploy/goerli/GoerliUpgrade1.s.sol b/script/deploy/goerli/GoerliUpgrade1.s.sol index 6a1cd2d0c..d5d351c69 100644 --- a/script/deploy/goerli/GoerliUpgrade1.s.sol +++ b/script/deploy/goerli/GoerliUpgrade1.s.sol @@ -4,18 +4,18 @@ pragma solidity =0.8.12; import "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol"; -import "src/contracts/interfaces/IETHPOSDeposit.sol"; -import "src/contracts/interfaces/IBeaconChainOracle.sol"; +import "../../../src/contracts/interfaces/IETHPOSDeposit.sol"; +import "../../../src/contracts/interfaces/IBeaconChainOracle.sol"; -import "src/contracts/core/StrategyManager.sol"; -import "src/contracts/core/Slasher.sol"; -import "src/contracts/core/DelegationManager.sol"; +import "../../../src/contracts/core/StrategyManager.sol"; +import "../../../src/contracts/core/Slasher.sol"; +import "../../../src/contracts/core/DelegationManager.sol"; -import "src/contracts/strategies/StrategyBase.sol"; +import "../../../src/contracts/strategies/StrategyBase.sol"; -import "src/contracts/pods/EigenPod.sol"; -import "src/contracts/pods/EigenPodManager.sol"; -import "src/contracts/pods/DelayedWithdrawalRouter.sol"; +import "../../../src/contracts/pods/EigenPod.sol"; +import "../../../src/contracts/pods/EigenPodManager.sol"; +import "../../../src/contracts/pods/DelayedWithdrawalRouter.sol"; import "forge-std/Script.sol"; diff --git a/script/deploy/goerli/GoerliUpgrade2.s.sol b/script/deploy/goerli/GoerliUpgrade2.s.sol index 0c204b626..edd98d05b 100644 --- a/script/deploy/goerli/GoerliUpgrade2.s.sol +++ b/script/deploy/goerli/GoerliUpgrade2.s.sol @@ -1,19 +1,19 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity =0.8.12; -import "src/contracts/interfaces/IETHPOSDeposit.sol"; +import "../../../src/contracts/interfaces/IETHPOSDeposit.sol"; -import "src/contracts/core/StrategyManager.sol"; -import "src/contracts/core/Slasher.sol"; -import "src/contracts/core/DelegationManager.sol"; -import "src/contracts/core/AVSDirectory.sol"; +import "../../../src/contracts/core/StrategyManager.sol"; +import "../../../src/contracts/core/Slasher.sol"; +import "../../../src/contracts/core/DelegationManager.sol"; +import "../../../src/contracts/core/AVSDirectory.sol"; -import "src/contracts/pods/EigenPod.sol"; -import "src/contracts/pods/EigenPodManager.sol"; -import "src/contracts/pods/DelayedWithdrawalRouter.sol"; +import "../../../src/contracts/pods/EigenPod.sol"; +import "../../../src/contracts/pods/EigenPodManager.sol"; +import "../../../src/contracts/pods/DelayedWithdrawalRouter.sol"; import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; -import "src/test/mocks/EmptyContract.sol"; +import "../../../src/test/mocks/EmptyContract.sol"; import "forge-std/Script.sol"; import "forge-std/Test.sol"; diff --git a/script/deploy/mainnet/M1_Deploy.s.sol b/script/deploy/mainnet/M1_Deploy.s.sol index a713c8d07..09548c3d7 100644 --- a/script/deploy/mainnet/M1_Deploy.s.sol +++ b/script/deploy/mainnet/M1_Deploy.s.sol @@ -6,23 +6,23 @@ import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; import "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol"; -import "src/contracts/interfaces/IETHPOSDeposit.sol"; -import "src/contracts/interfaces/IBeaconChainOracle.sol"; +import "../../../src/contracts/interfaces/IETHPOSDeposit.sol"; +import "../../../src/contracts/interfaces/IBeaconChainOracle.sol"; -import "src/contracts/core/StrategyManager.sol"; -import "src/contracts/core/Slasher.sol"; -import "src/contracts/core/DelegationManager.sol"; +import "../../../src/contracts/core/StrategyManager.sol"; +import "../../../src/contracts/core/Slasher.sol"; +import "../../../src/contracts/core/DelegationManager.sol"; -import "src/contracts/strategies/StrategyBaseTVLLimits.sol"; +import "../../../src/contracts/strategies/StrategyBaseTVLLimits.sol"; -import "src/contracts/pods/EigenPod.sol"; -import "src/contracts/pods/EigenPodManager.sol"; -import "src/contracts/pods/DelayedWithdrawalRouter.sol"; +import "../../../src/contracts/pods/EigenPod.sol"; +import "../../../src/contracts/pods/EigenPodManager.sol"; +import "../../../src/contracts/pods/DelayedWithdrawalRouter.sol"; -import "src/contracts/permissions/PauserRegistry.sol"; +import "../../../src/contracts/permissions/PauserRegistry.sol"; -import "src/test/mocks/EmptyContract.sol"; -import "src/test/mocks/ETHDepositMock.sol"; +import "../../../src/test/mocks/EmptyContract.sol"; +import "../../../src/test/mocks/ETHDepositMock.sol"; import "forge-std/Script.sol"; import "forge-std/Test.sol"; diff --git a/script/deploy/mainnet/M2Deploy.s.sol b/script/deploy/mainnet/M2Deploy.s.sol index d48e518e0..d93455e60 100644 --- a/script/deploy/mainnet/M2Deploy.s.sol +++ b/script/deploy/mainnet/M2Deploy.s.sol @@ -6,18 +6,18 @@ import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; import "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol"; -import "src/contracts/interfaces/IETHPOSDeposit.sol"; -import "src/contracts/interfaces/IBeaconChainOracle.sol"; +import "../../../src/contracts/interfaces/IETHPOSDeposit.sol"; +import "../../../src/contracts/interfaces/IBeaconChainOracle.sol"; -import "src/contracts/core/StrategyManager.sol"; -import "src/contracts/core/Slasher.sol"; -import "src/contracts/core/DelegationManager.sol"; +import "../../../src/contracts/core/StrategyManager.sol"; +import "../../../src/contracts/core/Slasher.sol"; +import "../../../src/contracts/core/DelegationManager.sol"; -import "src/contracts/pods/EigenPod.sol"; -import "src/contracts/pods/EigenPodManager.sol"; -import "src/contracts/pods/DelayedWithdrawalRouter.sol"; +import "../../../src/contracts/pods/EigenPod.sol"; +import "../../../src/contracts/pods/EigenPodManager.sol"; +import "../../../src/contracts/pods/DelayedWithdrawalRouter.sol"; -import "src/contracts/permissions/PauserRegistry.sol"; +import "../../../src/contracts/permissions/PauserRegistry.sol"; import "forge-std/Script.sol"; import "forge-std/Test.sol";