Skip to content

test: redistribution upgrade #1410

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

Merged
merged 9 commits into from
May 30, 2025
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
30 changes: 17 additions & 13 deletions script/configs/mainnet/mainnet-addresses.config.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
{
"lastUpdated": "v0.4.3-mainnet-foundation-incentives",
"lastUpdated": "v1.4.1-mainnet-prooftra",
"addresses": {
"allocationManager": "0x948a420b8CC1d6BFd0B6087C2E7c344a2CD0bc39",
"allocationManagerImplementation": "0x740058839A1668Af5700e5d7B062007275e77D25",
"avsDirectory": "0x135dda560e946695d6f155dacafc6f1f25c1f5af",
"avsDirectoryImplementation": "0xdabdb3cd346b7d5f5779b0b614ede1cc9dcba5b7",
"avsDirectoryImplementation": "0xA396D855D70e1A1ec1A0199ADB9845096683B6A2",
"beaconOracle": "0x343907185b71aDF0eBa9567538314396aa985442",
"baseStrategyImplementation": "0xdfdA04f980bE6A64E3607c95Ca26012Ab9aA46d3",
"baseStrategyImplementation": "0x0EC17ef9c00F360DB28CA8008684a4796b11E456",
"delayedWithdrawalRouter": "0x7Fe7E9CC0F274d2435AD5d56D5fa73E47F6A23D8",
"delayedWithdrawalRouterImplementation": "0x4bb6731b02314d40abbffbc4540f508874014226",
"delegationManager": "0x39053D51B77DC0d36036Fc1fCc8Cb819df8Ef37A",
"delegationManagerImplementation": "0x1784be6401339fc0fedf7e9379409f5c1bfe9dda",
"delegationManagerImplementation": "0xA75112d1df37FA53a431525CD47A7d7faCEA7E73",
"eigenLayerPauserReg": "0x0c431C66F4dE941d089625E5B423D00707977060",
"eigenLayerProxyAdmin": "0x8b9566AdA63B64d1E1dcF1418b43fd1433b72444",
"eigenPodBeacon": "0x5a2a4F2F3C18f09179B6703e63D9eDD165909073",
"eigenPodImplementation": "0x6D225e974Fa404D25Ffb84eD6E242Ffa18eF6430",
"eigenPodImplementation": "0xe2E2dB234b0FFB9AFe41e52dB7d3c2B8585646c3",
"eigenPodManager": "0x91E677b07F7AF907ec9a428aafA9fc14a0d3A338",
"eigenPodManagerImplementation": "0x731A0aD160e407393Ff662231Add6Dd145AD3FEa",
"eigenPodManagerImplementation": "0x8dB49233e3b7691D68745A31e4A0Cd9Cf924B7E9",
"emptyContract": "0x1f96861fEFa1065a5A96F20Deb6D8DC3ff48F7f9",
"permissionController": "0x25E5F8B1E7aDf44518d35D5B2271f114e081f0E5",
"permissionControllerImplementation": "0xe7f3705c9Addf2DE14e03C345fA982CAb2c1C6B1",
"rewardsCoordinator": "0x7750d328b314EfFa365A0402CcfD489B80B0adda",
"rewardsCoordinatorImplementation": "0xb6738A8E7793D44c5895B6A6F2a62F6bF86Ba8d2",
"rewardsCoordinatorImplementation": "0xa505c0116aD65071F0130061F94745b7853220aB",
"slasher": "0xD92145c07f8Ed1D392c1B88017934E301CC1c3Cd",
"slasherImplementation": "0xf3234220163a757edf1e11a8a085638d9b236614",
"strategyManager": "0x858646372CC42E1A627fcE94aa7A7033e7CF075A",
"strategyManagerImplementation": "0x70f44c13944d49a236e3cd7a94f48f5dab6c619b",
"strategyManagerImplementation": "0xba4b2b8A076851A3044882493C2e36503d50b925",
"strategyFactory": "0x5e4C39Ad7A3E881585e383dB9827EB4811f6F647",
"strategyFactoryImplementation": "0x3e07cc2D34C8E0965f5BA45Ac1E960e535155c74",
"strategyFactoryImplementation": "0x1b97d8F963179C0e17E5F3d85cdfd9a31A49bc66",
"strategyFactoryBeacon": "0x0ed6703C298d28aE0878d1b28e88cA87F9662fE9",
"strategyFactoryBeaconImplementation": "0xe9FA8F904d97854C7389b68923262ADCC6C27827",
"strategyFactoryBeaconImplementation": "0x0EC17ef9c00F360DB28CA8008684a4796b11E456",
"numStrategiesDeployed": 12,
"strategies": {
"stETH": "0x93c4b944D05dfe6df7645A86cd2206016c51564D",
Expand Down Expand Up @@ -62,20 +66,20 @@
"EIGENImpl": "0x17f56E911C279bad67eDC08acbC9cf3DC4eF26A0",
"bEIGENImpl": "0xF2b225815F70c9b327DC9db758A36c92A4279b17",
"eigenStrategy": "0xaCB55C530Acdb2849e6d4f36992Cd8c9D50ED8F7",
"eigenStrategyImpl": "0x27e7a3a81741b9fcc5ad7edcbf9f8a72a5c00428"
"eigenStrategyImpl": "0x90B074DDD680bD06C72e28b09231A0F848205729"
}
},
"numStrategies": 12,
"chainInfo": {
"chainId": 1,
"deploymentBlock": 20571838
"deploymentBlock": 22434239
},
"parameters": {
"communityMultisig": "0xFEA47018D632A77bA579846c840d5706705Dc598",
"executorMultisig": "0x369e6F597e22EaB55fFb173C6d9cD234BD699111",
"operationsMultisig": "0xBE1685C81aA44FF9FB319dD389addd9374383e90",
"pauserMultisig": "0x5050389572f2d220ad927CcbeA0D406831012390",
"timelock": "0xA6Db1A8C5a981d1536266D2a393c5F8dDb210EAF",
"semver": "v0.5.4"
"semver": "v1.4.1"
}
}
30 changes: 8 additions & 22 deletions script/utils/ExistingDeploymentParser.sol
Original file line number Diff line number Diff line change
Expand Up @@ -229,25 +229,10 @@ contract ExistingDeploymentParser is Script, Logger {
)
);

allocationManagerImplementation = new AllocationManager(
delegationManager,
eigenLayerPauserReg,
permissionController,
DEALLOCATION_DELAY,
ALLOCATION_CONFIGURATION_DELAY,
SEMVER
);
allocationManager = AllocationManager(
address(
new TransparentUpgradeableProxy(
address(allocationManagerImplementation), address(eigenLayerProxyAdmin), ""
)
)
);

// // AllocationManager
// allocationManager = AllocationManager(json.readAddress(".addresses.allocationManager"));
// allocationManagerImplementation = json.readAddress(".addresses.allocationManagerImplementation");
// AllocationManager
allocationManager = AllocationManager(json.readAddress(".addresses.allocationManager"));
allocationManagerImplementation =
AllocationManager(json.readAddress(".addresses.allocationManagerImplementation"));

// AVSDirectory
avsDirectory = AVSDirectory(json.readAddress(".addresses.avsDirectory"));
Expand All @@ -258,9 +243,10 @@ contract ExistingDeploymentParser is Script, Logger {
delegationManagerImplementation =
DelegationManager(json.readAddress(".addresses.delegationManagerImplementation"));

// // PermissionController
// permissionController = PermissionController(json.readAddress(".addresses.permissionController"));
// permissionControllerImplementation = json.readAddress(".addresses.permissionControllerImplementation");
// PermissionController
permissionController = PermissionController(json.readAddress(".addresses.permissionController"));
permissionControllerImplementation =
PermissionController(json.readAddress(".addresses.permissionControllerImplementation"));

// RewardsCoordinator
rewardsCoordinator = RewardsCoordinator(json.readAddress(".addresses.rewardsCoordinator"));
Expand Down
33 changes: 9 additions & 24 deletions src/test/integration/IntegrationBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import "src/test/integration/TypeImporter.t.sol";
import "src/test/integration/IntegrationDeployer.t.sol";
import "src/test/integration/TimeMachine.t.sol";
import "src/test/integration/users/User.t.sol";
import "src/test/integration/users/User_M1.t.sol";

abstract contract IntegrationBase is IntegrationDeployer, TypeImporter {
using StdStyle for *;
Expand Down Expand Up @@ -75,16 +74,10 @@ abstract contract IntegrationBase is IntegrationDeployer, TypeImporter {
uint[] memory addedShares = _calculateExpectedShares(strategies, tokenBalances);
operator.depositIntoEigenlayer(strategies, tokenBalances);

/// Registration flow differs for M2 vs Slashing release
if (!isUpgraded) {
User_M2(payable(operator)).registerAsOperator_M2();
/// Registration flow is the same pre and post redistribution upgrade
operator.registerAsOperator();

operatorsToMigrate.push(operator);
} else {
operator.registerAsOperator();

rollForward({blocks: ALLOCATION_CONFIGURATION_DELAY + 1});
}
rollForward({blocks: ALLOCATION_CONFIGURATION_DELAY + 1});

assert_Snap_Added_OperatorShares(operator, strategies, addedShares, "_newRandomOperator: failed to award shares to operator");
assertTrue(delegationManager.isOperator(address(operator)), "_newRandomOperator: operator should be registered");
Expand All @@ -96,16 +89,10 @@ abstract contract IntegrationBase is IntegrationDeployer, TypeImporter {
function _newRandomOperator_NoAssets() internal returns (User) {
User operator = _randUser_NoAssets(_getOperatorName());

/// Registration flow differs for M2 vs Slashing release
if (!isUpgraded) {
User_M2(payable(operator)).registerAsOperator_M2();
/// Registration flow is the same pre and post redistribution upgrade
operator.registerAsOperator();

operatorsToMigrate.push(operator);
} else {
operator.registerAsOperator();

rollForward({blocks: ALLOCATION_CONFIGURATION_DELAY + 1});
}
rollForward({blocks: ALLOCATION_CONFIGURATION_DELAY + 1});

assertTrue(delegationManager.isOperator(address(operator)), "_newRandomOperator: operator should be registered");
assertEq(delegationManager.delegatedTo(address(operator)), address(operator), "_newRandomOperator: should be self-delegated");
Expand All @@ -117,7 +104,7 @@ abstract contract IntegrationBase is IntegrationDeployer, TypeImporter {
numStakers++;

string memory stakerNum = cheats.toString(numStakers);
string memory namePrefix = isUpgraded ? "staker" : "m2-staker";
string memory namePrefix = isUpgraded ? "staker" : "pre-redistribution-staker";

return string.concat(namePrefix, stakerNum);
}
Expand All @@ -127,7 +114,7 @@ abstract contract IntegrationBase is IntegrationDeployer, TypeImporter {
numOperators++;

string memory operatorNum = cheats.toString(numOperators);
string memory namePrefix = isUpgraded ? "operator" : "m2-operator";
string memory namePrefix = isUpgraded ? "operator" : "pre-redistribution-operator";

return string.concat(namePrefix, operatorNum);
}
Expand Down Expand Up @@ -2431,9 +2418,7 @@ abstract contract IntegrationBase is IntegrationDeployer, TypeImporter {

function _calcNativeETHOperatorShareDelta(User staker, int shareDelta) internal view returns (int) {
// TODO: Maybe we update parent method to have an M2 and Slashing version?
int curPodOwnerShares;
if (!isUpgraded) curPodOwnerShares = IEigenPodManager_DeprecatedM2(address(eigenPodManager)).podOwnerShares(address(staker));
else curPodOwnerShares = eigenPodManager.podOwnerDepositShares(address(staker));
int curPodOwnerShares = eigenPodManager.podOwnerDepositShares(address(staker));
int newPodOwnerShares = curPodOwnerShares + shareDelta;

if (curPodOwnerShares <= 0) {
Expand Down
2 changes: 0 additions & 2 deletions src/test/integration/IntegrationChecks.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ pragma solidity ^0.8.27;

import "src/test/integration/IntegrationBase.t.sol";
import "src/test/integration/users/User.t.sol";
import "src/test/integration/users/User_M1.t.sol";
import "src/test/integration/users/User_M2.t.sol";

/// @notice Contract that provides utility functions to reuse common test blocks & checks
contract IntegrationCheckUtils is IntegrationBase {
Expand Down
9 changes: 4 additions & 5 deletions src/test/integration/IntegrationDeployer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import "src/test/integration/mocks/BeaconChainMock.t.sol";

import "src/test/integration/users/AVS.t.sol";
import "src/test/integration/users/User.t.sol";
import "src/test/integration/users/User_M1.t.sol";
import "src/test/integration/users/User_M2.t.sol";

import "script/utils/ExistingDeploymentParser.sol";

Expand All @@ -39,7 +37,7 @@ abstract contract IntegrationDeployer is ExistingDeploymentParser {

// Fork ids for specific fork tests
bool isUpgraded;
uint mainnetForkBlock = 21_616_692; // Post Protocol Council upgrade
uint mainnetForkBlock = 22_514_370; // Post Pectra Compatibility Upgrade

string version = "9.9.9";

Expand Down Expand Up @@ -591,12 +589,13 @@ abstract contract IntegrationDeployer is ExistingDeploymentParser {
} else {
revert("_randUser: unimplemented userType");
}
// Leaving this if statement for future upgraded users
} else if (forkType == MAINNET && !isUpgraded) {
if (userType == DEFAULT) {
user = User(new User_M2(name));
user = new User(name);
} else if (userType == ALT_METHODS) {
// User will use nonstandard methods like `depositIntoStrategyWithSignature`
user = User(new User_M2(name));
user = User(new User_AltMethods(name));
} else {
revert("_randUser: unimplemented userType");
}
Expand Down
26 changes: 2 additions & 24 deletions src/test/integration/UpgradeTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ pragma solidity ^0.8.27;

import "src/test/integration/IntegrationDeployer.t.sol";
import "src/test/integration/IntegrationChecks.t.sol";
import "src/test/integration/mocks/BeaconChainMock_Deneb.t.sol";

abstract contract UpgradeTest is IntegrationCheckUtils {
/// Only run upgrade tests on mainnet forks
Expand All @@ -13,9 +12,6 @@ abstract contract UpgradeTest is IntegrationCheckUtils {
} else {
isUpgraded = false;
super.setUp();

// Use Deneb Beacon Chain Mock as Pectra state is not live on mainnet
beaconChain = BeaconChainMock(new BeaconChainMock_DenebForkable(eigenPodManager, BEACON_GENESIS_TIME));
}
}

Expand All @@ -24,31 +20,13 @@ abstract contract UpgradeTest is IntegrationCheckUtils {
require(forkType == MAINNET, "_upgradeEigenLayerContracts: somehow running upgrade test locally");
require(!isUpgraded, "_upgradeEigenLayerContracts: already performed upgrade");

emit log("_upgradeEigenLayerContracts: upgrading mainnet to slashing");
emit log("_upgradeEigenLayerContracts: upgrading mainnet to redistribution");

_upgradeMainnetContracts();
_handlePectraFork();

// Bump block.timestamp forward to allow verifyWC proofs for migrated pods
emit log("advancing block time to start of next epoch:");

beaconChain.advanceEpoch_NoRewards();

emit log("======");

isUpgraded = true;
emit log("_upgradeEigenLayerContracts: slashing upgrade complete");
}

// Set the fork timestamp sufficiently in the future to keep using Deneb proofs
// `Prooftra.t.sol` will handle the Deneb -> Pectra transition
function _handlePectraFork() internal {
// 1. Set proof timestamp setter to operations multisig
cheats.prank(eigenPodManager.owner());
eigenPodManager.setProofTimestampSetter(address(operationsMultisig));

// 2. Set Proof timestamp
cheats.prank(eigenPodManager.proofTimestampSetter());
eigenPodManager.setPectraForkTimestamp(type(uint64).max);
emit log("_upgradeEigenLayerContracts: redistribution upgrade complete");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.27;

import "src/contracts/interfaces/IStrategy.sol";

/**
* @notice Interface of the allocationManager prior to redistribution.
* @dev The interface remains the exact same, except `SlashOperator` does not return the slashID or shares
* @dev This interface is the minimal possibl interface needed for the redistribution upgrade test
*/
interface IAllocationManager_PreRedistribution {
Copy link
Member

Choose a reason for hiding this comment

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

Is this needed given only return values were changed?

Copy link
Member

Choose a reason for hiding this comment

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

Main issue lies with existing return values changing, since contracts calling wold attempt to copy returndata that doesn't exist or is misplaced.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would assume it's not needed, but for some reason I'm reverting...

/**
* @notice Struct containing parameters to slashing
* @param operator the address to slash
* @param operatorSetId the ID of the operatorSet the operator is being slashed on behalf of
* @param strategies the set of strategies to slash
* @param wadsToSlash the parts in 1e18 to slash, this will be proportional to the operator's
* slashable stake allocation for the operatorSet
* @param description the description of the slashing provided by the AVS for legibility
*/
struct SlashingParams {
address operator;
uint32 operatorSetId;
IStrategy[] strategies;
uint[] wadsToSlash;
string description;
}

/**
* @notice Called by an AVS to slash an operator in a given operator set. The operator must be registered
* and have slashable stake allocated to the operator set.
*
* @param avs The AVS address initiating the slash.
* @param params The slashing parameters, containing:
* - operator: The operator to slash.
* - operatorSetId: The ID of the operator set the operator is being slashed from.
* - strategies: Array of strategies to slash allocations from (must be in ascending order).
* - wadsToSlash: Array of proportions to slash from each strategy (must be between 0 and 1e18).
* - description: Description of why the operator was slashed.
*
* @dev For each strategy:
* 1. Reduces the operator's current allocation magnitude by wadToSlash proportion.
* 2. Reduces the strategy's max and encumbered magnitudes proportionally.
* 3. If there is a pending deallocation, reduces it proportionally.
* 4. Updates the operator's shares in the DelegationManager.
*
* @dev Small slashing amounts may not result in actual token burns due to
* rounding, which will result in small amounts of tokens locked in the contract
* rather than fully burning through the burn mechanism.
*/
function slashOperator(address avs, SlashingParams calldata params) external;
}
Loading