diff --git a/script/releases/v1.0.0-slashing/1-deployContracts.s.sol b/script/releases/v1.0.0-slashing/1-deployContracts.s.sol new file mode 100644 index 000000000..869d67ce7 --- /dev/null +++ b/script/releases/v1.0.0-slashing/1-deployContracts.s.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.12; + +import {EOADeployer} from "zeus-templates/templates/EOADeployer.sol"; +import {EigenLabsUpgrade} from "../EigenLabsUpgrade.s.sol"; + +/** + * Purpose: use an EOA to deploy all of the new contracts for this upgrade. + */ +contract Deploy is EOADeployer { + using EigenLabsUpgrade for *; + + function _runAsEOA() internal override { + vm.startBroadcast(); + + // TODO(alex): deploy all of the slashing contracts, recording the address with `deploySingleton(addr, name)`. + // for `name`, likely use `this.impl(type(Contract).name)`. + + vm.stopBroadcast(); + } + + function testDeploy() public { + _runAsEOA(); + Deployment[] memory deploys = deploys(); + + // TODO(alex): assert on all of our deployments. + } +} diff --git a/script/releases/v1.0.0-slashing/2-queueUpgradeAndUnpause.s.sol b/script/releases/v1.0.0-slashing/2-queueUpgradeAndUnpause.s.sol new file mode 100644 index 000000000..deb0126a0 --- /dev/null +++ b/script/releases/v1.0.0-slashing/2-queueUpgradeAndUnpause.s.sol @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.12; + +import {MultisigCall, MultisigCallUtils, MultisigBuilder} from "zeus-templates/templates/MultisigBuilder.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; +import {EigenLabsUpgrade} from "../EigenLabsUpgrade.s.sol"; +import {EncGnosisSafe} from "zeus-templates/utils/EncGnosisSafe.sol"; +import {MultisigCallUtils, MultisigCall} from "zeus-templates/utils/MultisigCallUtils.sol"; +import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.sol"; + +/** + * Purpose: + * * enqueue a multisig transaction which; + * - upgrades all the relevant contracts, and + * - unpauses the system. + * This should be run via the protocol council multisig. + */ +contract Queue is MultisigBuilder { + using MultisigCallUtils for MultisigCall[]; + using EigenLabsUpgrade for *; + using EncGnosisSafe for *; + using MultisigCallUtils for *; + + MultisigCall[] private _executorCalls; + MultisigCall[] private _opsCalls; + + function _getMultisigTransactionCalldata() internal view returns (bytes memory) { + ProxyAdmin pa = ProxyAdmin(this._proxyAdmin()); + + // TODO(alex): multisig transaction calldata for upgrading all contracts from phase 1. + bytes memory executorMultisigCalldata = new bytes(0); + // for syntax, see rewardsv2 upgrade script + + return (executorMultisigCalldata); + } + + function _runAsMultisig() internal virtual override { + (bytes memory call) = _getMultisigTransactionCalldata(); + + TimelockController timelock = TimelockController(payable(this._timelock())); + timelock.schedule( + this._executorMultisig(), + 0, + call, + 0, + bytes32(0), + timelock.getMinDelay() + ); + } + + function testDeploy() virtual public { + zSetMultisigContext(this._protocolCouncilMultisig()); + execute(); + + TimelockController timelock = TimelockController(payable(this._timelock())); + bytes memory call = _getMultisigTransactionCalldata(); + bytes32 txHash = timelock.hashOperation(this._executorMultisig(), 0, call, 0, 0); + assertEq(timelock.isOperationPending(txHash), true, "Transaction should be queued."); + } +} diff --git a/script/releases/v1.0.0-slashing/3-pause.s.sol b/script/releases/v1.0.0-slashing/3-pause.s.sol new file mode 100644 index 000000000..36fe22f42 --- /dev/null +++ b/script/releases/v1.0.0-slashing/3-pause.s.sol @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.12; + +import {MultisigCall, MultisigCallUtils, MultisigBuilder} from "zeus-templates/templates/MultisigBuilder.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; +import {EigenLabsUpgrade} from "../EigenLabsUpgrade.s.sol"; +import {EncGnosisSafe} from "zeus-templates/utils/EncGnosisSafe.sol"; +import {MultisigCallUtils, MultisigCall} from "zeus-templates/utils/MultisigCallUtils.sol"; + +/** + * Purpose: Enqueue a transaction which immediately sets `EigenPodManager.PAUSED_START_CHECKPOINT=true` + */ +contract Pause is MultisigBuilder { + using MultisigCallUtils for MultisigCall[]; + using EigenLabsUpgrade for *; + using EncGnosisSafe for *; + using MultisigCallUtils for *; + + MultisigCall[] private _executorCalls; + MultisigCall[] private _opsCalls; + + function _runAsMultisig() internal virtual override { + // TODO: set: + // EigenPodManager.PAUSED_START_CHECKPOINT = true; + } + + function testDeploy() virtual public { + // TODO: this should run from pauser multisig + zSetMultisigContext(this._operationsMultisig()); + execute(); + + // TODO: assert side effects + } +} diff --git a/script/releases/v1.0.0-slashing/4-podCleanup.sh b/script/releases/v1.0.0-slashing/4-podCleanup.sh new file mode 100644 index 000000000..f467ceb02 --- /dev/null +++ b/script/releases/v1.0.0-slashing/4-podCleanup.sh @@ -0,0 +1 @@ +# TODO(justin): run a binary which completes all checkpoints on the network. \ No newline at end of file diff --git a/script/releases/v1.0.0-slashing/5-executeUpgradeAndUnpause.sol b/script/releases/v1.0.0-slashing/5-executeUpgradeAndUnpause.sol new file mode 100644 index 000000000..e489d3861 --- /dev/null +++ b/script/releases/v1.0.0-slashing/5-executeUpgradeAndUnpause.sol @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.12; + +import {MultisigCall, MultisigCallUtils} from "zeus-templates/templates/MultisigBuilder.sol"; +import {SafeTx, SafeTxUtils} from "zeus-templates/utils/SafeTxUtils.sol"; +import {Queue} from "./2-queueUpgradeAndUnpause.s.sol"; +import {EigenLabsUpgrade} from "../EigenLabsUpgrade.s.sol"; +import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; + +contract Execute is Queue { + using MultisigCallUtils for MultisigCall[]; + using SafeTxUtils for SafeTx; + using EigenLabsUpgrade for *; + + /** + * @dev Overrides the previous _execute function to execute the queued transactions. + */ + function _runAsMultisig() internal override { + bytes memory call = _getMultisigTransactionCalldata(); + TimelockController timelock = TimelockController(payable(this._timelock())); + timelock.execute( + this._executorMultisig(), + 0, + call, + 0, + bytes32(0) + ); + } + + function testDeploy() override public {} + + function testExecute() public { + // 1- run queueing logic + vm.startPrank(this._operationsMultisig()); + super._runAsMultisig(); + vm.stopPrank(); + + TimelockController timelock = this._timelock(); + bytes memory call = _getMultisigTransactionCalldata(); + bytes32 txHash = timelock.hashOperation(this._executorMultisig(), 0, call, 0, 0); + assertEq(timelock.isOperationPending(txHash), true, "Transaction should be queued and pending."); + + + // 2- warp past delay? + vm.warp(block.timestamp + timelock.getMinDelay()); // 1 tick after ETA + assertEq(timelock.isOperationReady(txHash), true, "Transaction should be executable."); + + // 3- execute + zSetMultisigContext(this._protocolCouncilMultisig()); + execute(); + + // 3. TODO: assert that the execute did something + } +} diff --git a/script/releases/v1.0.0-slashing/upgrade.json b/script/releases/v1.0.0-slashing/upgrade.json new file mode 100644 index 000000000..fee536a88 --- /dev/null +++ b/script/releases/v1.0.0-slashing/upgrade.json @@ -0,0 +1,27 @@ +{ + "name": "slashing", + "from": "0.5.2", + "to": "1.0.0", + "phases": [ + { + "type": "eoa", + "filename": "1-deployContracts.s.sol" + }, + { + "type": "multisig", + "filename": "2-queueUpgradeAndUnpause.s.sol" + }, + { + "type": "multisig", + "filename": "3-pause.s.sol" + }, + { + "type": "script", + "filename": "4-podCleanup.sh" + }, + { + "type": "multisig", + "filename": "5-executeUpgradeAndUnpause.s.sol" + } + ] +} \ No newline at end of file