Skip to content

Commit

Permalink
refactor: move beacon chain slashing out of slashing lib
Browse files Browse the repository at this point in the history
  • Loading branch information
wadealexc committed Nov 6, 2024
1 parent 88b5f17 commit 8c1a688
Show file tree
Hide file tree
Showing 47 changed files with 3,230 additions and 4,315 deletions.
2 changes: 1 addition & 1 deletion lib/forge-std
2 changes: 1 addition & 1 deletion script/deploy/devnet/Upgrade.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ contract Upgrade is ExistingDeploymentParser {
_parseDeployedContracts("script/output/holesky/pre_preprod_slashing.holesky.json");

vm.startBroadcast();
AVSDirectory newAVSDirectoryImplementation = new AVSDirectory(delegationManager, eigenLayerPauserReg, DEALLOCATION_DELAY);
AVSDirectory newAVSDirectoryImplementation = new AVSDirectory(delegationManager, eigenLayerPauserReg);
eigenLayerProxyAdmin.upgrade(ITransparentUpgradeableProxy(payable(address(avsDirectory))), address(newAVSDirectoryImplementation));
vm.stopBroadcast();

Expand Down
12 changes: 3 additions & 9 deletions script/deploy/devnet/deploy_from_scratch.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ contract DeployFromScratch is Script, Test {

delegationImplementation = new DelegationManager(avsDirectory, strategyManager, eigenPodManager, allocationManager, eigenLayerPauserReg, MIN_WITHDRAWAL_DELAY);
strategyManagerImplementation = new StrategyManager(delegation, eigenLayerPauserReg);
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg, DEALLOCATION_DELAY);
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg);
eigenPodManagerImplementation = new EigenPodManager(
ethPOSDeposit,
eigenPodBeacon,
Expand All @@ -248,13 +248,11 @@ contract DeployFromScratch is Script, Test {
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP
);
allocationManagerImplementation = new AllocationManager(delegation, avsDirectory, eigenLayerPauserReg, DEALLOCATION_DELAY, ALLOCATION_CONFIGURATION_DELAY);
allocationManagerImplementation = new AllocationManager(delegation, eigenLayerPauserReg, DEALLOCATION_DELAY, ALLOCATION_CONFIGURATION_DELAY);
strategyFactoryImplementation = new StrategyFactory(strategyManager, eigenLayerPauserReg);

// Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them.
{
IStrategy[] memory _strategies;
uint256[] memory _withdrawalDelayBlocks;
eigenLayerProxyAdmin.upgradeAndCall(
ITransparentUpgradeableProxy(payable(address(delegation))),
address(delegationImplementation),
Expand Down Expand Up @@ -495,10 +493,6 @@ contract DeployFromScratch is Script, Test {
allocationManagerContract.delegation() == delegation,
"allocationManager: delegation address not set correctly"
);
require(
allocationManagerContract.avsDirectory() == avsDirectory,
"allocationManager: avsDirectory address not set correctly"
);
}

function _verifyImplementationsSetCorrectly() internal view {
Expand Down Expand Up @@ -609,7 +603,7 @@ contract DeployFromScratch is Script, Test {
// require(eigenPodManager.paused() == 30, "eigenPodManager: init paused status set incorrectly");
}

function _verifyInitializationParams() internal {
function _verifyInitializationParams() internal view {
// // one week in blocks -- 50400
// uint32 STRATEGY_MANAGER_INIT_WITHDRAWAL_DELAY_BLOCKS = 7 days / 12 seconds;
// require(strategyManager.withdrawalDelayBlocks() == 7 days / 12 seconds,
Expand Down
4 changes: 2 additions & 2 deletions script/deploy/holesky/M2_Deploy_From_Scratch.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ contract M2_Deploy_Holesky_From_Scratch is ExistingDeploymentParser {
);

eigenPodBeacon = new UpgradeableBeacon(address(eigenPodImplementation));
avsDirectoryImplementation = new AVSDirectory(delegationManager, eigenLayerPauserReg, DEALLOCATION_DELAY);
avsDirectoryImplementation = new AVSDirectory(delegationManager, eigenLayerPauserReg);
delegationManagerImplementation = new DelegationManager(avsDirectory, strategyManager, eigenPodManager, allocationManager, eigenLayerPauserReg, MIN_WITHDRAWAL_DELAY);
strategyManagerImplementation = new StrategyManager(delegationManager, eigenLayerPauserReg);
eigenPodManagerImplementation = new EigenPodManager(
Expand All @@ -86,7 +86,7 @@ contract M2_Deploy_Holesky_From_Scratch is ExistingDeploymentParser {
delegationManager,
eigenLayerPauserReg
);
allocationManagerImplementation = new AllocationManager(delegationManager, avsDirectory, eigenLayerPauserReg, DEALLOCATION_DELAY, ALLOCATION_CONFIGURATION_DELAY);
allocationManagerImplementation = new AllocationManager(delegationManager, eigenLayerPauserReg, DEALLOCATION_DELAY, ALLOCATION_CONFIGURATION_DELAY);

// Third, upgrade the proxy contracts to point to the implementations
IStrategy[] memory initializeStrategiesToSetDelayBlocks = new IStrategy[](0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ contract Upgrade_Testnet_RewardsCoordinator is Deploy_Test_RewardsCoordinator, T
_verifyInitializationParams();
}

function _sanityCheckImplementations(RewardsCoordinator oldRc, RewardsCoordinator newRc) internal {
function _sanityCheckImplementations(RewardsCoordinator oldRc, RewardsCoordinator newRc) internal view {
// Verify configs between both rewardsCoordinatorImplementations
assertEq(
address(oldRc.delegationManager()),
Expand Down
6 changes: 3 additions & 3 deletions script/deploy/local/Deploy_From_Scratch.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ contract DeployFromScratch is Script, Test {

delegationImplementation = new DelegationManager(avsDirectory, strategyManager, eigenPodManager, allocationManager, eigenLayerPauserReg, MIN_WITHDRAWAL_DELAY);
strategyManagerImplementation = new StrategyManager(delegation, eigenLayerPauserReg);
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg, DEALLOCATION_DELAY);
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg);
eigenPodManagerImplementation = new EigenPodManager(
ethPOSDeposit,
eigenPodBeacon,
Expand All @@ -254,7 +254,7 @@ contract DeployFromScratch is Script, Test {
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP
);
allocationManagerImplementation = new AllocationManager(delegation, avsDirectory, eigenLayerPauserReg, DEALLOCATION_DELAY, ALLOCATION_CONFIGURATION_DELAY);
allocationManagerImplementation = new AllocationManager(delegation, eigenLayerPauserReg, DEALLOCATION_DELAY, ALLOCATION_CONFIGURATION_DELAY);

// Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them.
{
Expand Down Expand Up @@ -585,7 +585,7 @@ contract DeployFromScratch is Script, Test {
// require(eigenPodManager.paused() == 30, "eigenPodManager: init paused status set incorrectly");
}

function _verifyInitializationParams() internal {
function _verifyInitializationParams() internal view {
// // one week in blocks -- 50400
// uint32 STRATEGY_MANAGER_INIT_WITHDRAWAL_DELAY_BLOCKS = 7 days / 12 seconds;
// require(strategyManager.withdrawalDelayBlocks() == 7 days / 12 seconds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ contract Upgrade_Mainnet_RewardsCoordinator is ExistingDeploymentParser, Timeloc
_verifyInitializationParams();
}

function _sanityCheckImplementations(RewardsCoordinator oldRc, RewardsCoordinator newRc) internal {
function _sanityCheckImplementations(RewardsCoordinator oldRc, RewardsCoordinator newRc) internal view {
// Verify configs between both rewardsCoordinatorImplementations
assertEq(
address(oldRc.delegationManager()),
Expand Down
2 changes: 0 additions & 2 deletions script/utils/ExistingDeploymentParser.sol
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,6 @@ contract ExistingDeploymentParser is Script, Test {
);
// DelegationManager
vm.expectRevert(bytes("Initializable: contract is already initialized"));
IStrategy[] memory initializeStrategiesToSetDelayBlocks = new IStrategy[](0);
uint256[] memory initializeWithdrawalDelayBlocks = new uint256[](0);
delegationManager.initialize(
address(0),
0
Expand Down
Loading

0 comments on commit 8c1a688

Please sign in to comment.