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

chore: mainnet deploy scripts for vanilla and avs registries #476

Merged
merged 6 commits into from
Nov 11, 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
10 changes: 10 additions & 0 deletions contracts/contracts/validator-registry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,13 @@ The owner account is also able to call `withdraw` for any validator pubkey who's
Note the permissioned oracle account for this contract can slash any validator that proposes a block which does not deliver preconfs from the mev-commit network. This corresponds to some configurable portion of the validator's stake being slashed (immediately sent to the contracts' `slashReceiver`).

Further, slashing automatically unstakes the relevant validator pubkey. If the relevant validator was already unstaking, the `unstakePeriodBlocks` timer is reset, and this period must be fully elapsed again before non-slashed funds are withdrawable.

### Configuration of `unstakePeriodBlocks`

`unstakePeriodBlocks` must be set such that a mev-commit bidder knows all _currently opted-in_ block proposers from the current epoch, and next epoch, must deliver commitments, or are guaranteed slashable.

For similar reasoning to the `slashPeriodSeconds` configuration in the [middleware README](middleware/README.md#configuration-of-slashperiodseconds), the minimum value for `unstakePeriodBlocks` is:

`6 L1 epochs` + `oracleProcessingPeriod`

A recommended value to assume for `oracleProcessingPeriod` is 60 minutes, although longer is always beneficial as a buffer for oracle transaction inclusion.
10 changes: 10 additions & 0 deletions contracts/contracts/validator-registry/avs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ Freezing is the mechanism that punishes a validator prior to eigenlayer core con

Frozen validators (those who haven't yet paid the unfreeze fee) are **able, but not allowed** to register with the vanilla registry or middleware registry. In these scenarios, the frozen validator will be immediately slashed by the oracle via the relevant contract, directly after registration. The off-chain oracle logic **must** monitor registrations from the vanilla registry and middleware registry, along with freeze status from the MevCommitAVS. The oracle will slash relevant frozen validator(s) if any of them attempt to maliciously register outside the MevCommitAVS, without paying the unfreeze fee.

## Configuration of Deregistration Periods

`operatorDeregPeriodBlocks`, `validatorDeregPeriodBlocks`, and `lstRestakerDeregPeriodBlocks` must be set such that a mev-commit bidder knows all _currently opted-in_ block proposers from the current epoch, and next epoch, must deliver commitments, or are guaranteed freezable.

For similar reasoning to the `slashPeriodSeconds` configuration in the [middleware README](../middleware/README.md#configuration-of-slashperiodseconds), the minimum value for these deregistration periods is:

`6 L1 epochs` + `oracleProcessingPeriod`

A recommended value to assume for `oracleProcessingPeriod` is 60 minutes, although longer is always beneficial as a buffer for oracle freeze transaction inclusion.

## Design Intentions

When looking through this design doc one may ask, _why do validators and LST restakers have to delegate to an Operator through the eigenlayer core contracts, AND separately register with the AVS contract?_
Expand Down
8 changes: 8 additions & 0 deletions contracts/scripts/MainnetConstants.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: BSL 1.1

pragma solidity 0.8.26;

library MainnetConstants {
/// @notice DO NOT assume this address is valid on any chain other than mainnet.
address constant public PRIMEV_TEAM_MULTISIG = 0x9101eda106A443A0fA82375936D0D1680D5a64F5;
}
17 changes: 17 additions & 0 deletions contracts/scripts/validator-registry/DeployVanillaRegistry.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {Script} from "forge-std/Script.sol";
import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";
import {VanillaRegistry} from "../../contracts/validator-registry/VanillaRegistry.sol";
import {console} from "forge-std/console.sol";
import {MainnetConstants} from "../MainnetConstants.sol";

contract BaseDeploy is Script {
function deployVanillaRegistry(
Expand All @@ -34,6 +35,22 @@ contract BaseDeploy is Script {
}
}

contract DeployMainnet is BaseDeploy {
address constant public OWNER = MainnetConstants.PRIMEV_TEAM_MULTISIG;
uint256 constant public MIN_STAKE = 1 ether;
address constant public SLASH_ORACLE = MainnetConstants.PRIMEV_TEAM_MULTISIG;
address constant public SLASH_RECEIVER = MainnetConstants.PRIMEV_TEAM_MULTISIG;
uint256 constant public UNSTAKE_PERIOD_BLOCKS = 50000; // 50k * 12s ~= 1 week, which suffices for short-term manual slashing.
uint256 constant public PAYOUT_PERIOD_BLOCKS = 12000; // ~ 1 day

function run() external {
require(block.chainid == 1, "must deploy on mainnet");
vm.startBroadcast();
deployVanillaRegistry(MIN_STAKE, SLASH_ORACLE, SLASH_RECEIVER, UNSTAKE_PERIOD_BLOCKS, PAYOUT_PERIOD_BLOCKS, OWNER);
vm.stopBroadcast();
}
}

contract DeployHolesky is BaseDeploy {
uint256 constant public MIN_STAKE = 0.0001 ether; // 10k vals = 1 ETH cost
address constant public SLASH_ORACLE = 0x4535bd6fF24860b5fd2889857651a85fb3d3C6b1;
Expand Down
53 changes: 53 additions & 0 deletions contracts/scripts/validator-registry/avs/DeployAVS.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {IEigenPodManager} from "eigenlayer-contracts/src/contracts/interfaces/IE
import {IStrategyManager} from "eigenlayer-contracts/src/contracts/interfaces/IStrategyManager.sol";
import {IAVSDirectory} from "eigenlayer-contracts/src/contracts/interfaces/IAVSDirectory.sol";
import {EigenHoleskyReleaseConsts} from "./ReleaseAddrConsts.sol";
import {EigenMainnetReleaseConsts} from "./ReleaseAddrConsts.sol";
import {MainnetConstants} from "../../MainnetConstants.sol";

contract BaseDeploy is Script {
function deployMevCommitAVS(
Expand Down Expand Up @@ -62,6 +64,57 @@ contract BaseDeploy is Script {
}
}

contract DeployMainnet is BaseDeploy {
address constant public OWNER = MainnetConstants.PRIMEV_TEAM_MULTISIG;
IDelegationManager constant public DELEGATION_MANAGER = IDelegationManager(EigenMainnetReleaseConsts.DELEGATION_MANAGER);
IEigenPodManager constant public EIGENPOD_MANAGER = IEigenPodManager(EigenMainnetReleaseConsts.EIGENPOD_MANAGER);
IStrategyManager constant public STRATEGY_MANAGER = IStrategyManager(EigenMainnetReleaseConsts.STRATEGY_MANAGER);
IAVSDirectory constant public AVS_DIRECTORY = IAVSDirectory(EigenMainnetReleaseConsts.AVS_DIRECTORY);
address constant public FREEZE_ORACLE = MainnetConstants.PRIMEV_TEAM_MULTISIG;
uint256 constant public UNFREEZE_FEE = 1 ether;
address constant public UNFREEZE_RECEIVER = MainnetConstants.PRIMEV_TEAM_MULTISIG;
uint256 constant public UNFREEZE_PERIOD_BLOCKS = 12000; // ~ 1 day
uint256 constant public OPERATOR_DEREG_PERIOD_BLOCKS = 50000; // 50k * 12s ~= 1 week, which suffices for short-term manual slashing.
uint256 constant public VALIDATOR_DEREG_PERIOD_BLOCKS = 50000; // 50k * 12s ~= 1 week, which suffices for short-term manual slashing.
uint256 constant public LST_RESTARKER_DEREG_PERIOD_BLOCKS = 50000; // 50k * 12s ~= 1 week, which suffices for short-term manual slashing.

function run() external {
require(block.chainid == 1, "must deploy on mainnet");
vm.startBroadcast();
address[] memory restakeableStrategies = new address[](11);
restakeableStrategies[0] = EigenMainnetReleaseConsts.STRATEGY_BASE_CBETH;
restakeableStrategies[1] = EigenMainnetReleaseConsts.STRATEGY_BASE_STETH;
restakeableStrategies[2] = EigenMainnetReleaseConsts.STRATEGY_BASE_RETH;
restakeableStrategies[3] = EigenMainnetReleaseConsts.STRATEGY_BASE_ETHX;
restakeableStrategies[4] = EigenMainnetReleaseConsts.STRATEGY_BASE_ANKRETH;
restakeableStrategies[5] = EigenMainnetReleaseConsts.STRATEGY_BASE_OETH;
restakeableStrategies[6] = EigenMainnetReleaseConsts.STRATEGY_BASE_OSETH;
restakeableStrategies[7] = EigenMainnetReleaseConsts.STRATEGY_BASE_SWETH;
restakeableStrategies[8] = EigenMainnetReleaseConsts.STRATEGY_BASE_WBETH;
restakeableStrategies[9] = EigenMainnetReleaseConsts.STRATEGY_BASE_SFRXETH;
restakeableStrategies[10] = EigenMainnetReleaseConsts.STRATEGY_BASE_LSETH;
restakeableStrategies[11] = EigenMainnetReleaseConsts.STRATEGY_BASE_METH;
restakeableStrategies[12] = EigenMainnetReleaseConsts.BEACON_CHAIN_ETH;

deployMevCommitAVS(
OWNER,
DELEGATION_MANAGER,
EIGENPOD_MANAGER,
STRATEGY_MANAGER,
AVS_DIRECTORY,
restakeableStrategies,
FREEZE_ORACLE,
UNFREEZE_FEE,
UNFREEZE_RECEIVER,
UNFREEZE_PERIOD_BLOCKS,
OPERATOR_DEREG_PERIOD_BLOCKS,
VALIDATOR_DEREG_PERIOD_BLOCKS,
LST_RESTARKER_DEREG_PERIOD_BLOCKS
);
vm.stopBroadcast();
}
}

contract DeployHolesky is BaseDeploy {
// This is the most important field. On mainnet it'll be the primev multisig.
address constant public OWNER = 0x4535bd6fF24860b5fd2889857651a85fb3d3C6b1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
pragma solidity 0.8.26;

/// @notice Constants from https://github.com/Layr-Labs/eigenlayer-contracts?tab=readme-ov-file#deployments,
/// @notice Last updated 07-26-2024
/// @notice Last updated 11-07-2024
library EigenMainnetReleaseConsts {

address internal constant DELEGATION_MANAGER = 0x39053D51B77DC0d36036Fc1fCc8Cb819df8Ef37A;
Expand Down
Loading