Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
wadealexc committed Sep 20, 2024
1 parent 038ff2f commit 9f6543b
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 67 deletions.
25 changes: 20 additions & 5 deletions script/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
## Release Scripting

Desired usecases:
* Creating a new release script from a template (e.g. `zeus new v0.4.2-pepe`)
* Being able to see whether a release script has been run for a given environment (`zeus status v0.4.2-pepe`)
* Since release scripts are split into 3 parts (`deploy`, `queue`, `execute`), being able to see

`zeus run deploy pepe --sender "0x1234"`

`zeus run deploy pepe --live --ledger`

`zeus run queue pepe --live --ledger`
* https://docs.safe.global/sdk/api-kit
* For proposing txns to the Safe UI

`zeus status pepe`

### Creating a New Release Script

```
make release $RELEASE_NAME
zeus new $VERSION $RELEASE_NAME
```

This command will generate a new release script based on `Release_Template.s.sol`. The new script is placed in the `/releases` folder and named accordingly (e.g. `make release pepe` will create `releases/Release_pepe.s.sol`).
This command will generate a new release script based on `Release_Template.s.sol`. The new script is placed in the `/releases` folder and named accordingly (e.g. `zeus new v0.4.2-pepe` will create `releases/v0.4.2-pepe/script.s.sol`).

Release scripts look like this:

Expand All @@ -21,16 +36,16 @@ contract Release_TEMPLATE is Releasoor {
using TxBuilder for *;
using AddressUtils for *;
function deploy(Addresses memory addrs) public override {
function deploy(Addresses memory addrs) internal override {
// If you're deploying contracts, do that here
}
function queueUpgrade(Addresses memory addrs) public override {
function queueUpgrade(Addresses memory addrs) internal override {
// If you're queueing an upgrade via the timelock, you can
// define and encode those transactions here
}
function executeUpgrade(Addresses memory addrs) public override {
function executeUpgrade(Addresses memory addrs) internal override {
// Whether you are using the timelock or just making transactions
// from the ops multisig, you can define/encode those transactions here
}
Expand Down
139 changes: 80 additions & 59 deletions script/Release.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,30 @@ contract Release is Releasoor {
using TxBuilder for *;
using AddressUtils for *;

struct ReleaseStep {
function () external step;
}

// Public, standard release:
// - EOA deploy
// - queue/execute via ops multisig/timelock
function manifest() public returns (ReleaseStep[] memory steps) {
return _newRelease(ReleaseType.OPS_TIMELOCK)
.append(this.deploy)
.append(this.queueUpgrade)
.wait(10 days)
.append(this.executeUpgrade);
}

// Private, emergency release:
// - EOA deploy
// - execute instantly via community msig
function manifest() public returns (ReleaseStep[] memory steps) {
return _newRelease(ReleaseType.COMMUNITY_MSIG)
.append(this.deploy)
.append(this.executeUpgrade);
}

function deploy(Addresses memory addrs) internal override {
vm.startBroadcast();

Expand All @@ -30,9 +54,6 @@ contract Release is Releasoor {

addrs.eigenPod.setPending(address(newEigenPodImpl));
addrs.eigenPodManager.setPending(address(newEPMImpl));

_log("pending pod", addrs.eigenPod.getPending());
_log("pending podManager", addrs.eigenPodManager.getPending());
}

function queueUpgrade(Addresses memory addrs) internal override {
Expand Down Expand Up @@ -122,63 +143,63 @@ contract Release is Releasoor {
addrs.eigenPodManager.updateFromPending();
}

// function queueUpgrade(Addresses memory addrs) internal override returns (Txns storage) {
// Txns storage txns = addrs.opsMultisig.queueTimelock({
// timelock: addrs.timelock,
// eta: 0,
// _txns: addrs.executorMultisig
// .append({
// to: addrs.strategyManager.proxy,
// data: EncStrategyManager.setStrategyWhitelister(addrs.opsMultisig)
// })
// .append({
// to: addrs.eigenPod.beacon,
// data: EncBeacon.upgradeTo(addrs.eigenPod.getPending())
// })
// .append({
// to: addrs.proxyAdmin,
// data: EncProxyAdmin.upgrade(addrs.eigenPodManager.proxy, addrs.eigenPodManager.getPending())
// })
// .asSafeExecTxn();
// });

// txns.printSummary();

// return txns;
// }
function queueUpgrade(Addresses memory addrs) internal override returns (Txns storage) {
Txns storage txns = addrs.opsMultisig.queueTimelock({
timelock: addrs.timelock,
eta: 0,
_txns: addrs.executorMultisig
.append({
to: addrs.strategyManager.proxy,
data: EncStrategyManager.setStrategyWhitelister(addrs.opsMultisig)
})
.append({
to: addrs.eigenPod.beacon,
data: EncBeacon.upgradeTo(addrs.eigenPod.getPending())
})
.append({
to: addrs.proxyAdmin,
data: EncProxyAdmin.upgrade(addrs.eigenPodManager.proxy, addrs.eigenPodManager.getPending())
})
.asSafeExecTxn();
});

// function executeUpgrade(Addresses memory addrs) internal override returns (Txns storage) {
// Txns storage txns = addrs.opsMultisig.executeTimelock({
// timelock: addrs.timelock,
// eta: 0,
// to: addrs.executorMultisig,
// data: addrs.executorMultisig
// .append({
// to: addrs.strategyManager.proxy,
// data: EncStrategyManager.setStrategyWhitelister(addrs.opsMultisig)
// })
// .append({
// to: addrs.eigenPod.beacon,
// data: EncBeacon.upgradeTo(addrs.eigenPod.pendingImpl)
// })
// .append({
// to: addrs.proxyAdmin,
// data: EncProxyAdmin.upgrade(addrs.eigenPodManager.proxy, addrs.eigenPodManager.pendingImpl)
// })
// })
// .append({
// to: addrs.strategyManager.proxy,
// data: EncStrategyManager.addStrategiesToDepositWhitelist(strats, bools)
// });

// txns.printSummary();

// // Update config
// addrs.eigenPod.updateFromPending();
// addrs.eigenPodManager.updateFromPending();

// return txns;
// }
txns.printSummary();

return txns;
}

function executeUpgrade(Addresses memory addrs) internal override returns (Txns storage) {
Txns storage txns = addrs.opsMultisig.executeTimelock({
timelock: addrs.timelock,
eta: 0,
to: addrs.executorMultisig,
data: addrs.executorMultisig
.append({
to: addrs.strategyManager.proxy,
data: EncStrategyManager.setStrategyWhitelister(addrs.opsMultisig)
})
.append({
to: addrs.eigenPod.beacon,
data: EncBeacon.upgradeTo(addrs.eigenPod.pendingImpl)
})
.append({
to: addrs.proxyAdmin,
data: EncProxyAdmin.upgrade(addrs.eigenPodManager.proxy, addrs.eigenPodManager.pendingImpl)
})
})
.append({
to: addrs.strategyManager.proxy,
data: EncStrategyManager.addStrategiesToDepositWhitelist(strats, bools)
});

txns.printSummary();

// Update config
addrs.eigenPod.updateFromPending();
addrs.eigenPodManager.updateFromPending();

return txns;
}

// function _deployPEPE(Addresses memory addrs) internal returns (EigenPod, EigenPodManager) {
// // Deploy EigenPod
Expand Down
24 changes: 24 additions & 0 deletions script/releases/v0.4.2-pepe/Script.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.12;

import "./utils/Releasoor.s.sol";

contract v0_4_2_ is Releasoor {

using TxBuilder for *;
using AddressUtils for *;

function deploy(Addresses memory addrs) internal override {
// If you're deploying contracts, do that here
}

function queueUpgrade(Addresses memory addrs) internal override returns (Tx[] memory executorTxns, uint eta) {
// If you're queueing an upgrade via the timelock, you can
// define and encode those transactions here
}

function executeUpgrade(Addresses memory addrs) internal override {
// Whether you are using the timelock or just making transactions
// from the ops multisig, you can define/encode those transactions here
}
}
Empty file.
3 changes: 0 additions & 3 deletions script/utils/Releasoor.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ contract Releasoor is ConfigParser {
string constant CONFIG_PREPROD = "script/configs/preprod.json";

string constant CONFIG_ZIPZOOP = "script/configs/zipzoop.json";

// https://docs.safe.global/sdk/api-kit
// For proposing txns to the Safe UI

/// $ run execute mainnet
/// -- requires that you have previously run deploy and queue
Expand Down

0 comments on commit 9f6543b

Please sign in to comment.