Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: m2_deploy_from_scratch script for devnet #495

Merged
merged 3 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/run-deploy-scripts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Run Deploy Scripts
# We run the deploy scripts just to make sure they work

on:
push:
pull_request:
types: [opened, reopened]

jobs:
prepare:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true

# install foundry to run forge script. Should we run forge script in a container instead?
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Start Anvil chain
# need to start Anvil chain with -d to let the container run in the background
# if we start with 'anvil &' instead, the process stops when the step ends
run: docker run -d --rm -p 8545:8545 --entrypoint anvil ghcr.io/foundry-rs/foundry:nightly-5b7e4cb3c882b28f3c32ba580de27ce7381f415a --host 0.0.0.0

- name: Wait for Anvil chain to start
run: sleep 3

# Run Forge script against the Anvil chain
- name: Run M2_Deploy_From_Scratch
run: |
forge script script/deploy/devnet/M2_Deploy_From_Scratch.s.sol --rpc-url http://localhost:8545 \
--private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 --broadcast \
--sig "run(string memory configFileName)" -- M2_deploy_from_scratch.anvil.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"MAX_RESTAKED_BALANCE_GWEI_PER_VALIDATOR": "32000000000"
},
"eigenPodManager": {
"max_pods": 0,
"init_paused_status": 30
},
"delayedWithdrawalRouter": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";

import "../../src/contracts/interfaces/IETHPOSDeposit.sol";
import "../../src/contracts/interfaces/IBeaconChainOracle.sol";
import "../../../src/contracts/interfaces/IETHPOSDeposit.sol";
import "../../../src/contracts/interfaces/IBeaconChainOracle.sol";

import "../../src/contracts/core/StrategyManager.sol";
import "../../src/contracts/core/Slasher.sol";
import "../../src/contracts/core/DelegationManager.sol";
import "../../src/contracts/core/AVSDirectory.sol";
import "../../../src/contracts/core/StrategyManager.sol";
import "../../../src/contracts/core/Slasher.sol";
import "../../../src/contracts/core/DelegationManager.sol";
import "../../../src/contracts/core/AVSDirectory.sol";

import "../../src/contracts/strategies/StrategyBaseTVLLimits.sol";
import "../../../src/contracts/strategies/StrategyBaseTVLLimits.sol";

import "../../src/contracts/pods/EigenPod.sol";
import "../../src/contracts/pods/EigenPodManager.sol";
import "../../src/contracts/pods/DelayedWithdrawalRouter.sol";
import "../../../src/contracts/pods/EigenPod.sol";
import "../../../src/contracts/pods/EigenPodManager.sol";
import "../../../src/contracts/pods/DelayedWithdrawalRouter.sol";

import "../../src/contracts/permissions/PauserRegistry.sol";
import "../../../src/contracts/permissions/PauserRegistry.sol";

import "../../src/test/mocks/EmptyContract.sol";
import "../../src/test/mocks/ETHDepositMock.sol";
import "../../../src/test/mocks/EmptyContract.sol";
import "../../../src/test/mocks/ETHDepositMock.sol";

import "forge-std/Script.sol";
import "forge-std/Test.sol";
Expand Down Expand Up @@ -87,28 +87,26 @@ contract Deployer_M2 is Script, Test {
uint256 DELEGATION_INIT_PAUSED_STATUS;
uint256 DELEGATION_WITHDRAWAL_DELAY_BLOCKS;
uint256 EIGENPOD_MANAGER_INIT_PAUSED_STATUS;
uint256 EIGENPOD_MANAGER_MAX_PODS;
uint256 DELAYED_WITHDRAWAL_ROUTER_INIT_PAUSED_STATUS;

// one week in blocks -- 50400
uint32 STRATEGY_MANAGER_INIT_WITHDRAWAL_DELAY_BLOCKS;
uint32 DELAYED_WITHDRAWAL_ROUTER_INIT_WITHDRAWAL_DELAY_BLOCKS;

function run(string memory configFile) external {
function run(string memory configFileName) external {
// read and log the chainID
uint256 chainId = block.chainid;
emit log_named_uint("You are deploying on ChainID", chainId);

// READ JSON CONFIG DATA
deployConfigPath = string(bytes(string.concat("script/testing/", configFile)));
deployConfigPath = string(bytes(string.concat("script/configs/devnet/", configFileName)));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually wondering if we shouldn't get rid of the script/configs/devnet/ prefix and just let the user pass in an absolute path. This way any other avs repo that uses this script as a submodule could create its own deploy config file and pass it in, as opposed to having to go create a PR in eigenlayer-contracts to add a new config file, which doesn't make sense.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah seems reasonable. Decoupling logging the output json from the deploy might be a good direction. Teams will either write their logs in the intended directory structure or parse the broadcast logs

string memory config_data = vm.readFile(deployConfigPath);
// bytes memory parsedData = vm.parseJson(config_data);

STRATEGY_MANAGER_INIT_PAUSED_STATUS = stdJson.readUint(config_data, ".strategyManager.init_paused_status");
SLASHER_INIT_PAUSED_STATUS = stdJson.readUint(config_data, ".slasher.init_paused_status");
DELEGATION_INIT_PAUSED_STATUS = stdJson.readUint(config_data, ".delegation.init_paused_status");
DELEGATION_WITHDRAWAL_DELAY_BLOCKS = stdJson.readUint(config_data, ".delegation.init_withdrawal_delay_blocks");
EIGENPOD_MANAGER_MAX_PODS = stdJson.readUint(config_data, ".eigenPodManager.max_pods");
EIGENPOD_MANAGER_INIT_PAUSED_STATUS = stdJson.readUint(config_data, ".eigenPodManager.init_paused_status");
DELAYED_WITHDRAWAL_ROUTER_INIT_PAUSED_STATUS = stdJson.readUint(
config_data,
Expand Down Expand Up @@ -258,7 +256,6 @@ contract Deployer_M2 is Script, Test {
address(eigenPodManagerImplementation),
abi.encodeWithSelector(
EigenPodManager.initialize.selector,
EIGENPOD_MANAGER_MAX_PODS,
IBeaconChainOracle(address(0)),
executorMultisig,
eigenLayerPauserReg,
Expand Down Expand Up @@ -392,7 +389,7 @@ contract Deployer_M2 is Script, Test {
string memory finalJson = vm.serializeString(parent_object, parameters, parameters_output);
// TODO: should output to different file depending on configFile passed to run()
// so that we don't override mainnet output by deploying to goerli for eg.
vm.writeJson(finalJson, "script/output/M2_from_scratch_deployment_data.json");
vm.writeJson(finalJson, "script/output/devnet/M2_from_scratch_deployment_data.json");
}

function _verifyContractsPointAtOneAnother(
Expand Down Expand Up @@ -495,7 +492,7 @@ contract Deployer_M2 is Script, Test {
require(delegation.owner() == executorMultisig, "delegation: owner not set correctly");
// removing slasher requirements because there is no slasher as part of m2-mainnet release
// require(slasher.owner() == executorMultisig, "slasher: owner not set correctly");
require(eigenPodManager.owner() == executorMultisig, "delegation: owner not set correctly");
require(eigenPodManager.owner() == executorMultisig, "eigenPodManager: owner not set correctly");

require(eigenLayerProxyAdmin.owner() == executorMultisig, "eigenLayerProxyAdmin: owner not set correctly");
require(eigenPodBeacon.owner() == executorMultisig, "eigenPodBeacon: owner not set correctly");
Expand Down
Loading