Skip to content

Commit

Permalink
feat: add m2 upgrade output file (#482)
Browse files Browse the repository at this point in the history
* feat: add m2 upgrade output file

* fix: consistent writing + reading of deployment params

naming should now be consistent, so the ExistingDeploymentParser
should work with unmodified script outputs

* feat: appropriately parse new implementation addresses

`test_queueUpgrade` now more accurately models the upgrade,
and no longer simulates implementation deployment

* chore: appropriate timelock ETA

* chore: add a couple more "sanity" checks

these are performed after the upgrade is simulated
  • Loading branch information
ChaoticWalrus authored Mar 26, 2024
1 parent 4b15d68 commit bc2ce17
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 14 deletions.
55 changes: 47 additions & 8 deletions script/deploy/mainnet/M2_Mainnet_Upgrade.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,13 @@ contract M2_Mainnet_Upgrade is ExistingDeploymentParser {
contract Queue_M2_Upgrade is M2_Mainnet_Upgrade, TimelockEncoding {
Vm cheats = Vm(HEVM_ADDRESS);

// Thurs Apr 04 2024 12:00:00 GMT-0700 (Pacific Daylight Time)
uint256 timelockEta = 1712214000;
// Thurs Apr 08 2024 12:00:00 GMT-0700 (Pacific Daylight Time)
uint256 timelockEta = 1712559600;

function test_queueUpgrade() external {
_parseDeployedContracts("script/output/mainnet/M1_deployment_mainnet_2023_6_9.json");
_parseDeployedContracts("script/output/mainnet/M2_mainnet_upgrade.output.json");
_parseInitialDeploymentParams("script/configs/mainnet/M2_mainnet_upgrade.config.json");

// TODO: fill in correct addresses
// simulate deploying contracts
_deployImplementationContracts();

Tx[] memory txs = new Tx[](11);
// upgrade the DelegationManager, Slasher, StrategyManager, DelayedWithdrawalRouter, EigenPodManager, & EigenPod contracts
txs[0] = Tx(
Expand Down Expand Up @@ -267,7 +263,6 @@ contract Queue_M2_Upgrade is M2_Mainnet_Upgrade, TimelockEncoding {
data: final_calldata_to_executor_multisig,
// time at which the tx will become executable
timelockEta: timelockEta

});

bytes32 expectedTxHash = getTxHash({
Expand Down Expand Up @@ -295,6 +290,50 @@ contract Queue_M2_Upgrade is M2_Mainnet_Upgrade, TimelockEncoding {
_verifyImplementations();
_verifyContractsInitialized({isInitialDeployment: true});
_verifyInitializationParams();
_postUpgradeChecks();
}

function _postUpgradeChecks() internal {
// check that LST deposits are paused
address rETH = 0xae78736Cd615f374D3085123A210448E74Fc6393;
address rETH_Strategy = 0x1BeE69b7dFFfA4E2d53C2a2Df135C388AD25dCD2;
uint256 amount = 1e18;
cheats.prank(rETH);
// this works because rETH has more than 1 ETH of its own token at its address :)
IERC20(rETH).transfer(address(this), amount);
IERC20(rETH).approve(address(strategyManager), amount);
cheats.expectRevert("Pausable: index is paused");
strategyManager.depositIntoStrategy({
strategy: IStrategy(rETH_Strategy),
token: IERC20(rETH),
amount: amount
});

// unpause LST deposits and check that a deposit works
cheats.prank(executorMultisig);
strategyManager.unpause(0);
strategyManager.depositIntoStrategy({
strategy: IStrategy(rETH_Strategy),
token: IERC20(rETH),
amount: amount
});

// check that EigenPod proofs are live (although this still reverts later in the call)
EigenPod existingEigenPod = EigenPod(payable(0x0b347D5E38296277E829CE1D8C6b82e4c63C2Df3));
BeaconChainProofs.StateRootProof memory stateRootProof;
uint40[] memory validatorIndices;
bytes[] memory validatorFieldsProofs;
bytes32[][] memory validatorFields;
cheats.startPrank(existingEigenPod.podOwner());
existingEigenPod.activateRestaking();
cheats.expectRevert("EigenPodManager.getBlockRootAtTimestamp: state root at timestamp not yet finalized");
existingEigenPod.verifyWithdrawalCredentials(
uint64(block.timestamp),
stateRootProof,
validatorIndices,
validatorFieldsProofs,
validatorFields
);
}

function getTxHash(address target, uint256 _value, bytes memory _data, uint256 eta) public pure returns (bytes32) {
Expand Down
6 changes: 3 additions & 3 deletions script/output/mainnet/M1_deployment_mainnet_2023_6_9.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"avsDirectory": "0x0000000000000000000000000000000000000000",
"avsDirectoryImplementation": "0x0000000000000000000000000000000000000000",
"baseStrategyImplementation": "0xdfdA04f980bE6A64E3607c95Ca26012Ab9aA46d3",
"beaconOracleAddress": "0x0000000000000000000000000000000000000000",
"beaconOracle": "0x0000000000000000000000000000000000000000",
"delayedWithdrawalRouter": "0x7Fe7E9CC0F274d2435AD5d56D5fa73E47F6A23D8",
"delayedWithdrawalRouterImplementation": "0x44Bcb0E01CD0C5060D4Bb1A07b42580EF983E2AF",
"delegation": "0x39053D51B77DC0d36036Fc1fCc8Cb819df8Ef37A",
"delegationImplementation": "0xf97E97649Da958d290e84E6D571c32F4b7F475e4",
"delegationManager": "0x39053D51B77DC0d36036Fc1fCc8Cb819df8Ef37A",
"delegationManagerImplementation": "0xf97E97649Da958d290e84E6D571c32F4b7F475e4",
"eigenLayerPauserReg": "0x0c431C66F4dE941d089625E5B423D00707977060",
"eigenLayerProxyAdmin": "0x8b9566AdA63B64d1E1dcF1418b43fd1433b72444",
"eigenPodBeacon": "0x5a2a4F2F3C18f09179B6703e63D9eDD165909073",
Expand Down
35 changes: 35 additions & 0 deletions script/output/mainnet/M2_mainnet_upgrade.output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"addresses": {
"avsDirectory": "0x135DDa560e946695d6f155dACaFC6f1F25C1F5AF",
"avsDirectoryImplementation": "0xdAbdB3Cd346B7D5F5779b0B614EdE1CC9DcBA5b7",
"baseStrategyImplementation": "0xdfdA04f980bE6A64E3607c95Ca26012Ab9aA46d3",
"beaconOracle": "0x343907185b71aDF0eBa9567538314396aa985442",
"delayedWithdrawalRouter": "0x7Fe7E9CC0F274d2435AD5d56D5fa73E47F6A23D8",
"delayedWithdrawalRouterImplementation": "0x4bB6731B02314d40aBbfFBC4540f508874014226",
"delegationManager": "0x39053D51B77DC0d36036Fc1fCc8Cb819df8Ef37A",
"delegationManagerImplementation": "0x1784BE6401339Fc0Fedf7E9379409f5c1BfE9dda",
"eigenLayerPauserReg": "0x0c431C66F4dE941d089625E5B423D00707977060",
"eigenLayerProxyAdmin": "0x8b9566AdA63B64d1E1dcF1418b43fd1433b72444",
"eigenPodBeacon": "0x5a2a4F2F3C18f09179B6703e63D9eDD165909073",
"eigenPodImplementation": "0x8bA40dA60f0827d027F029aCEE62609F0527a255",
"eigenPodManager": "0x91E677b07F7AF907ec9a428aafA9fc14a0d3A338",
"eigenPodManagerImplementation": "0xe4297e3DaDBc7D99e26a2954820f514CB50C5762",
"emptyContract": "0x1f96861fEFa1065a5A96F20Deb6D8DC3ff48F7f9",
"slasher": "0xD92145c07f8Ed1D392c1B88017934E301CC1c3Cd",
"slasherImplementation": "0xF3234220163a757edf1E11a8a085638D9B236614",
"strategies": "",
"strategyManager": "0x858646372CC42E1A627fcE94aa7A7033e7CF075A",
"strategyManagerImplementation": "0x70f44C13944d49a236E3cD7a94f48f5daB6C619b"
},
"chainInfo": {
"chainId": 1,
"deploymentBlock": 19492753
},
"parameters": {
"communityMultisig": "0xFEA47018D632A77bA579846c840d5706705Dc598",
"executorMultisig": "0x369e6F597e22EaB55fFb173C6d9cD234BD699111",
"operationsMultisig": "0xBE1685C81aA44FF9FB319dD389addd9374383e90",
"pauserMultisig": "0x5050389572f2d220ad927CcbeA0D406831012390",
"timelock": "0xA6Db1A8C5a981d1536266D2a393c5F8dDb210EAF"
}
}
7 changes: 4 additions & 3 deletions script/utils/ExistingDeploymentParser.sol
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ contract ExistingDeploymentParser is Script, Test {
slasherImplementation = Slasher(
stdJson.readAddress(existingDeploymentData, ".addresses.slasherImplementation")
);
delegationManager = DelegationManager(stdJson.readAddress(existingDeploymentData, ".addresses.delegation"));
delegationManager = DelegationManager(stdJson.readAddress(existingDeploymentData, ".addresses.delegationManager"));
delegationManagerImplementation = DelegationManager(
stdJson.readAddress(existingDeploymentData, ".addresses.delegationImplementation")
stdJson.readAddress(existingDeploymentData, ".addresses.delegationManagerImplementation")
);
avsDirectory = AVSDirectory(stdJson.readAddress(existingDeploymentData, ".addresses.avsDirectory"));
avsDirectoryImplementation = AVSDirectory(
Expand All @@ -152,7 +152,7 @@ contract ExistingDeploymentParser is Script, Test {
stdJson.readAddress(existingDeploymentData, ".addresses.delayedWithdrawalRouterImplementation")
);
beaconOracle = IBeaconChainOracle(
stdJson.readAddress(existingDeploymentData, ".addresses.beaconOracleAddress")
stdJson.readAddress(existingDeploymentData, ".addresses.beaconOracle")
);
eigenPodBeacon = UpgradeableBeacon(stdJson.readAddress(existingDeploymentData, ".addresses.eigenPodBeacon"));
eigenPodImplementation = EigenPod(
Expand Down Expand Up @@ -650,6 +650,7 @@ contract ExistingDeploymentParser is Script, Test {
vm.serializeAddress(parameters, "operationsMultisig", operationsMultisig);
vm.serializeAddress(parameters, "communityMultisig", communityMultisig);
vm.serializeAddress(parameters, "pauserMultisig", pauserMultisig);
vm.serializeAddress(parameters, "timelock", timelock);
string memory parameters_output = vm.serializeAddress(parameters, "operationsMultisig", operationsMultisig);

string memory chain_info = "chainInfo";
Expand Down

0 comments on commit bc2ce17

Please sign in to comment.