Skip to content

Commit

Permalink
wip: further vibes
Browse files Browse the repository at this point in the history
  • Loading branch information
wadealexc committed Aug 22, 2024
1 parent 83cb000 commit df090b9
Show file tree
Hide file tree
Showing 3 changed files with 201 additions and 0 deletions.
87 changes: 87 additions & 0 deletions release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,90 @@ make deploy preprod
* Deploys the entire system to `preprod` using the `DeployAll` script
* Generates an output file that gives the config for this new system. This is generated to a `.gitignored` directory, but if moved into the `config` folder, it can become a named, usable environment

---

## Preprod Release Workflow

#### Deploying New Contracts

```
$ make release pepe
Generated release script: `./scripts/v0_4_5_pepe.s.sol`
```

<Edit script (`deploy`)>

```
$ make deploy pepe --preprod --dry-run
Launching anvil using $RPC... done
Running `v0_4_5_pepe.s.sol:deploy`... done
Results ("preprod.json"):
{
"eigenPod": {
"pendingImpl": "0xDEADBEEF"
},
"eigenPodManager": {
"pendingImpl": "0xABADDEED"
}
}
```

<Confirm results look correct, then run again>

```
$ make deploy pepe --preprod
Launching anvil using $RPC... done
Running `v0_4_5_pepe.s.sol:deploy`... done
Results ("preprod.json"):
{
"eigenPod": {
"pendingImpl": "0xDEADBEEF"
},
"eigenPodManager": {
"pendingImpl": "0xABADDEED"
}
}
Is this correct? Press (y/n) to update config: y
Updating `config/preprod.json`... done
```

Contracts should be successfully deployed, and config updated.

#### Perform Upgrade

<Edit existing script (`execute`)>

```
$ make execute pepe --preprod --dry-run
Launching anvil using $RPC... done
Running `v0_4_5_pepe.s.sol:execute`... done
Actions:
[
"executorMultisig": [
"eigenPodBeacon.proxy.upgradeTo(pendingImpl)",
"proxyAdmin.upgrade(eigenPodManager.proxy, pendingImpl)"
]
]
Results ("preprod.json"):
{
"eigenPod": {
"impl": "0xDEADBEEF"
},
"eigenPodManager": {
"impl": "0xABADDEED"
}
}
```
44 changes: 44 additions & 0 deletions release/scripts/mainnet-pepe.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
pragma solidity ^0.8.12;

import "src/*";

contract Mainnet_PEPE_0_4_2 is DeploymentUtils {

function deploy() public virtual {
// Deploy EigenPod
eigenPodImplementation = new EigenPod(
IETHPOSDeposit(ETHPOSDepositAddress),
eigenPodManager,
EIGENPOD_GENESIS_TIME
);

// Deploy EigenPodManager
eigenPodManagerImplementation = new EigenPodManager(
IETHPOSDeposit(ETHPOSDepositAddress),
eigenPodBeacon,
strategyManager,
slasher,
delegationManager
);

cfg.setDeploy(EIGENPOD, address(eigenPodImplementation));
cfg.setDeploy(EIGENPOD_MANAGER, address(eigenPodManagerImplementation));
}

function queueUpgrade() public virtual {

}

function executeQueued() public virtual {

}

// Executor multisig calls proxyAdmin/beacon proxies and upgrades
// (or calls contracts and sets values)
function doUpgrade() public virtual {
return executorMultisig.startBroadcast()
.upgrade(eigenPodBeacon, newEigenPodImpl)
.upgrade(eigenPodManager, newEigenPodManagerImpl)
.stopBroadcast();
}
}
70 changes: 70 additions & 0 deletions release/scripts/v0_4_5_pepe.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.8.12;

import "@compound/contracts/Timelock.sol";
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";

import "forge-std/Script.sol";
import "forge-std/Test.sol";

import "../../utils/EncodeSafeTransactionMainnet.sol";
import "../../utils/Multisend.sol";
import "../../utils/ProxyInterfaces.sol";

contract v0_4_5_pepe is EncodeSafeTransactionMainnet, Script {

function deploy() public {
// Deploy EigenPod
EigenPod newEigenPodImpl = new EigenPod(
cfg.ETHPOSDepositAddress,
cfg.eigenPodManager.proxy,
cfg.EIGENPOD_GENESIS_TIME
);

// Deploy EigenPodManager
EigenPodManager newEigenPodManagerImpl = new EigenPodManager(
cfg.ETHPOSDepositAddress,
cfg.eigenPodBeacon.proxy,
cfg.strategyManager.proxy,
cfg.slasher.proxy,
cfg.delegationManager.proxy
);

// Updates `config/$network.json` with a "pendingImpl" for both of these contracts
cfg.eigenPodBeacon.setPending(address(newEigenPodImpl));
cfg.eigenPodManager.setPending(address(newEigenPodManagerImpl));
}

function test_Deploy() public {
deploy();

// Check constants/immutables set on deployment
require(EigenPod(cfg.eigenPodBeacon.pendingImpl).activeValidatorCount() == 0);
}

// Mock out the upgrade flow as if you were pranking the executor multisig
//
// Depending on the network you're using, this will resolve to:
// - (local) pranking the executor multisig and running the calls
// - (preprod) multicall via the gigawhale private key
// - (holesky) multicall via the community multisig
// - (mainnet) queue + execute via ops and timelock
function execute() public {
executorMultisig.startBroadcast() // start building txn
.upgrade(eigenPodBeacon, cfg.eigenPodBeacon.pendingImpl) // create call to BeaconProxy
.upgrade(eigenPodManager, cfg.eigenPodManager.pendingImpl) // create call to ProxyAdmin
.stopBroadcast(); // finish txn as multicall
}

function test_Execute() public {
// do some initial checks here
vm.expectRevert();
IEigenPod(cfg.eigenPodBeacon.impl).activeValidatorCount();

// run the upgrade
execute();

// do some final checks here
require(IEigenPod(cfg.eigenPodBeacon.impl).activeValidatorCount() == 0);
}
}

0 comments on commit df090b9

Please sign in to comment.