-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
212 additions
and
1 deletion.
There are no files selected for viewing
Submodule zeus-templates
updated
9 files
+0 −5 | .github/workflows/test.yml | |
+3 −0 | foundry.toml | |
+1 −1 | src/interfaces/ISafe.sol | |
+2 −0 | src/interfaces/ITimelock.sol | |
+18 −19 | src/templates/EOADeployer.sol | |
+16 −17 | src/templates/MultisigBuilder.sol | |
+6 −17 | src/utils/EncGnosisSafe.sol | |
+2 −15 | src/utils/MultisigCallUtils.sol | |
+250 −38 | src/utils/ZeusScript.sol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"solidity.defaultCompiler": "localNodeModule" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
script/releases/v1.0.0-slashing/2-queueUpgradeAndUnpause.s.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# TODO(justin): run a binary which completes all checkpoints on the network. |
56 changes: 56 additions & 0 deletions
56
script/releases/v1.0.0-slashing/5-executeUpgradeAndUnpause.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
] | ||
} |