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

[1.0.0] slashing upgrade script #916

Open
wants to merge 19 commits into
base: slashing-magnitudes
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion lib/zeus-templates
Submodule zeus-templates updated 76 files
+42 −7 .github/workflows/test.yml
+2 −0 .gitignore
+3 −0 .gitmodules
+0 −1 foundry.toml
+1 −0 lib/forge-std
+0 −1 lib/forge-std/.gitattributes
+0 −128 lib/forge-std/.github/workflows/ci.yml
+0 −31 lib/forge-std/.github/workflows/sync.yml
+0 −4 lib/forge-std/.gitignore
+0 −181 lib/forge-std/CONTRIBUTING.md
+0 −203 lib/forge-std/LICENSE-APACHE
+0 −25 lib/forge-std/LICENSE-MIT
+0 −266 lib/forge-std/README.md
+0 −21 lib/forge-std/foundry.toml
+0 −16 lib/forge-std/package.json
+0 −646 lib/forge-std/scripts/vm.py
+0 −35 lib/forge-std/src/Base.sol
+0 −27 lib/forge-std/src/Script.sol
+0 −669 lib/forge-std/src/StdAssertions.sol
+0 −263 lib/forge-std/src/StdChains.sol
+0 −817 lib/forge-std/src/StdCheats.sol
+0 −15 lib/forge-std/src/StdError.sol
+0 −122 lib/forge-std/src/StdInvariant.sol
+0 −283 lib/forge-std/src/StdJson.sol
+0 −43 lib/forge-std/src/StdMath.sol
+0 −473 lib/forge-std/src/StdStorage.sol
+0 −333 lib/forge-std/src/StdStyle.sol
+0 −283 lib/forge-std/src/StdToml.sol
+0 −226 lib/forge-std/src/StdUtils.sol
+0 −33 lib/forge-std/src/Test.sol
+0 −2,058 lib/forge-std/src/Vm.sol
+0 −1,560 lib/forge-std/src/console.sol
+0 −4 lib/forge-std/src/console2.sol
+0 −105 lib/forge-std/src/interfaces/IERC1155.sol
+0 −12 lib/forge-std/src/interfaces/IERC165.sol
+0 −43 lib/forge-std/src/interfaces/IERC20.sol
+0 −190 lib/forge-std/src/interfaces/IERC4626.sol
+0 −164 lib/forge-std/src/interfaces/IERC721.sol
+0 −73 lib/forge-std/src/interfaces/IMulticall3.sol
+0 −234 lib/forge-std/src/mocks/MockERC20.sol
+0 −231 lib/forge-std/src/mocks/MockERC721.sol
+0 −13,937 lib/forge-std/src/safeconsole.sol
+0 −145 lib/forge-std/test/StdAssertions.t.sol
+0 −228 lib/forge-std/test/StdChains.t.sol
+0 −618 lib/forge-std/test/StdCheats.t.sol
+0 −120 lib/forge-std/test/StdError.t.sol
+0 −49 lib/forge-std/test/StdJson.t.sol
+0 −202 lib/forge-std/test/StdMath.t.sol
+0 −471 lib/forge-std/test/StdStorage.t.sol
+0 −110 lib/forge-std/test/StdStyle.t.sol
+0 −49 lib/forge-std/test/StdToml.t.sol
+0 −342 lib/forge-std/test/StdUtils.t.sol
+0 −18 lib/forge-std/test/Vm.t.sol
+0 −10 lib/forge-std/test/compilation/CompilationScript.sol
+0 −10 lib/forge-std/test/compilation/CompilationScriptBase.sol
+0 −10 lib/forge-std/test/compilation/CompilationTest.sol
+0 −10 lib/forge-std/test/compilation/CompilationTestBase.sol
+0 −187 lib/forge-std/test/fixtures/broadcast.log.json
+0 −8 lib/forge-std/test/fixtures/test.json
+0 −6 lib/forge-std/test/fixtures/test.toml
+0 −441 lib/forge-std/test/mocks/MockERC20.t.sol
+0 −721 lib/forge-std/test/mocks/MockERC721.t.sol
+12 −0 src/interfaces/IMultiSend.sol
+18 −0 src/interfaces/IProxyAdmin.sol
+14 −0 src/interfaces/ITransparentUpgradeableProxy.sol
+8 −0 src/interfaces/IUpgradeableBeacon.sol
+28 −1 src/templates/EOADeployer.sol
+31 −19 src/templates/MultisigBuilder.sol
+0 −49 src/utils/EncGnosisSafe.sol
+156 −0 src/utils/Encode.sol
+0 −43 src/utils/MultisigCallUtils.sol
+0 −39 src/utils/SafeTxUtils.sol
+19 −0 src/utils/ScriptHelpers.sol
+286 −0 src/utils/ZEnvHelpers.sol
+62 −216 src/utils/ZeusScript.sol
+580 −0 test/ZeusScript.test.sol
88 changes: 0 additions & 88 deletions script/releases/EigenLabsUpgrade.s.sol

This file was deleted.

266 changes: 266 additions & 0 deletions script/releases/Env.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.12;

import "forge-std/Vm.sol";
import "zeus-templates/utils/ZEnvHelpers.sol";

import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.sol";

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

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

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

/// strategies/
import "src/contracts/strategies/EigenStrategy.sol";
import "src/contracts/strategies/StrategyBase.sol";
import "src/contracts/strategies/StrategyBaseTVLLimits.sol";
import "src/contracts/strategies/StrategyFactory.sol";

library Env {

using ZEnvHelpers for *;

/// Dummy types and variables to facilitate syntax, e.g: `Env.proxy.delegationManager()`
enum DeployedProxy { A }
enum DeployedImpl { A }
enum DeployedInstance { A }

DeployedProxy internal constant proxy = DeployedProxy.A;
DeployedImpl internal constant impl = DeployedImpl.A;
DeployedInstance internal constant instance = DeployedInstance.A;

/**
* env
*/

function executorMultisig() internal view returns (address) {
return _envAddress("executorMultisig");
}

function opsMultisig() internal view returns (address) {
return _envAddress("operationsMultisig");
}

function protocolCouncilMultisig() internal view returns (address) {
return _envAddress("protocolCouncilMultisig");
}

function pauserMultisig() internal view returns (address) {
return _envAddress("pauserMultisig");
}

function proxyAdmin() internal view returns (address) {
return _envAddress("proxyAdmin");
}

function ethPOS() internal view returns (IETHPOSDeposit) {
return IETHPOSDeposit(_envAddress("ethPOS"));
}

function timelockController() internal view returns (TimelockController) {
return TimelockController(payable(_envAddress("timelockController")));
}

function multiSendCallOnly() internal view returns (address) {
return _envAddress("MultiSendCallOnly");
}

function EIGENPOD_GENESIS_TIME() internal view returns (uint64) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can be removed entirely and also from EigenPod.sol itself

Copy link
Collaborator

Choose a reason for hiding this comment

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

I swear we removed this though way back

return _envU64("EIGENPOD_GENESIS_TIME");
}

function MIN_WITHDRAWAL_DELAY() internal view returns (uint32) {
return _envU32("MIN_WITHDRAWAL_DELAY");
}

function ALLOCATION_CONFIGURATION_DELAY() internal view returns (uint32) {
return _envU32("ALLOCATION_CONFIGURATION_DELAY");
}

function CALCULATION_INTERVAL_SECONDS() internal view returns (uint32) {
return _envU32("REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS");
}

function MAX_REWARDS_DURATION() internal view returns (uint32) {
return _envU32("REWARDS_COORDINATOR_MAX_REWARDS_DURATION");
}

function MAX_RETROACTIVE_LENGTH() internal view returns (uint32) {
return _envU32("REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH");
}

function MAX_FUTURE_LENGTH() internal view returns (uint32) {
return _envU32("REWARDS_COORDINATOR_MAX_FUTURE_LENGTH");
}

function GENESIS_REWARDS_TIMESTAMP() internal view returns (uint32) {
return _envU32("REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP");
}

/**
* core/
*/

function allocationManager(DeployedProxy) internal view returns (AllocationManager) {
return AllocationManager(_deployedProxy(type(AllocationManager).name));
}

function allocationManager(DeployedImpl) internal view returns (AllocationManager) {
return AllocationManager(_deployedImpl(type(AllocationManager).name));
}

function avsDirectory(DeployedProxy) internal view returns (AVSDirectory) {
return AVSDirectory(_deployedProxy(type(AVSDirectory).name));
}

function avsDirectory(DeployedImpl) internal view returns (AVSDirectory) {
return AVSDirectory(_deployedImpl(type(AVSDirectory).name));
}

function delegationManager(DeployedProxy) internal view returns (DelegationManager) {
return DelegationManager(_deployedProxy(type(DelegationManager).name));
}

function delegationManager(DeployedImpl) internal view returns (DelegationManager) {
return DelegationManager(_deployedImpl(type(DelegationManager).name));
}

function rewardsCoordinator(DeployedProxy) internal view returns (RewardsCoordinator) {
return RewardsCoordinator(_deployedProxy(type(RewardsCoordinator).name));
}

function rewardsCoordinator(DeployedImpl) internal view returns (RewardsCoordinator) {
return RewardsCoordinator(_deployedImpl(type(RewardsCoordinator).name));
}

function strategyManager(DeployedProxy) internal view returns (StrategyManager) {
return StrategyManager(_deployedProxy(type(StrategyManager).name));
}

function strategyManager(DeployedImpl) internal view returns (StrategyManager) {
return StrategyManager(_deployedImpl(type(StrategyManager).name));
}

/**
* permissions/
*/

function pauserRegistry(DeployedImpl) internal view returns (PauserRegistry) {
return PauserRegistry(_deployedImpl(type(PauserRegistry).name));
}

function permissionController(DeployedProxy) internal view returns (PermissionController) {
return PermissionController(_deployedProxy(type(PermissionController).name));
}

function permissionController(DeployedImpl) internal view returns (PermissionController) {
return PermissionController(_deployedImpl(type(PermissionController).name));
}

/**
* pods/
*/

function eigenPod(DeployedProxy) internal view returns (EigenPod) {
Copy link
Contributor

Choose a reason for hiding this comment

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

hm. this is gross. makes it weird to treat a beacon the same way as TUPs...

I need to read thru zeus

return EigenPod(payable(_deployedProxy(type(EigenPod).name)));
}

function eigenPod(DeployedImpl) internal view returns (EigenPod) {
return EigenPod(payable(_deployedImpl(type(EigenPod).name)));
}

function eigenPodManager(DeployedProxy) internal view returns (EigenPodManager) {
return EigenPodManager(_deployedProxy(type(EigenPodManager).name));
}

function eigenPodManager(DeployedImpl) internal view returns (EigenPodManager) {
return EigenPodManager(_deployedImpl(type(EigenPodManager).name));
}

/**
* strategies/
*/

function eigenStrategy(DeployedProxy) internal view returns (EigenStrategy) {
return EigenStrategy(_deployedProxy(type(EigenStrategy).name));
}

function eigenStrategy(DeployedImpl) internal view returns (EigenStrategy) {
return EigenStrategy(_deployedImpl(type(EigenStrategy).name));
}

// Beacon proxy
function strategyBase(DeployedProxy) internal view returns (StrategyBase) {
return StrategyBase(_deployedProxy(type(StrategyBase).name));
}

// Beaconed impl
function strategyBase(DeployedImpl) internal view returns (StrategyBase) {
return StrategyBase(_deployedImpl(type(StrategyBase).name));
}

// Returns the number of proxy instances
function strategyBaseTVLLimits_Count(DeployedInstance) internal view returns (uint) {
return _deployedInstanceCount(type(StrategyBaseTVLLimits).name);
}

// Returns the proxy instance at index `i`
function strategyBaseTVLLimits(DeployedInstance, uint i) internal view returns (StrategyBaseTVLLimits) {
return StrategyBaseTVLLimits(_deployedInstance(type(StrategyBaseTVLLimits).name, i));
}

function strategyBaseTVLLimits(DeployedImpl) internal view returns (StrategyBaseTVLLimits) {
return StrategyBaseTVLLimits(_deployedImpl(type(StrategyBaseTVLLimits).name));
}

function strategyFactory(DeployedProxy) internal view returns (StrategyFactory) {
return StrategyFactory(_deployedProxy(type(StrategyFactory).name));
}

function strategyFactory(DeployedImpl) internal view returns (StrategyFactory) {
return StrategyFactory(_deployedImpl(type(StrategyFactory).name));
}

/**
* Helpers
*/

function _deployedInstance(string memory name, uint idx) private view returns (address) {
return ZEnvHelpers.state().deployedInstance(name, idx);
}

function _deployedInstanceCount(string memory name) private view returns (uint) {
return ZEnvHelpers.state().deployedInstanceCount(name);
}

function _deployedProxy(string memory name) private view returns (address) {
return ZEnvHelpers.state().deployedProxy(name);
}

function _deployedImpl(string memory name) private view returns (address) {
return ZEnvHelpers.state().deployedImpl(name);
}

function _envAddress(string memory key) private view returns (address) {
return ZEnvHelpers.state().envAddress(key);
}

function _envU64(string memory key) private view returns (uint64) {
return ZEnvHelpers.state().envU64(key);
}

function _envU32(string memory key) private view returns (uint32) {
return ZEnvHelpers.state().envU32(key);
}
}
Loading
Loading