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

feat: add SemVerMixin #1034

Merged
merged 6 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
34 changes: 22 additions & 12 deletions script/deploy/devnet/deploy_from_scratch.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -257,18 +257,28 @@ contract DeployFromScratch is Script, Test {
eigenLayerPauserReg
);
rewardsCoordinatorImplementation = new RewardsCoordinator(
delegation,
strategyManager,
allocationManager,
eigenLayerPauserReg,
permissionController,
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP
);
allocationManagerImplementation = new AllocationManager(delegation, eigenLayerPauserReg, permissionController, DEALLOCATION_DELAY, ALLOCATION_CONFIGURATION_DELAY);
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams(
delegation,
strategyManager,
allocationManager,
eigenLayerPauserReg,
permissionController,
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP,
EIP712_VERSION
)
);
allocationManagerImplementation = new AllocationManager(
delegation,
eigenLayerPauserReg,
permissionController,
DEALLOCATION_DELAY,
ALLOCATION_CONFIGURATION_DELAY,
EIP712_VERSION
);
permissionControllerImplementation = new PermissionController();
strategyFactoryImplementation = new StrategyFactory(strategyManager, eigenLayerPauserReg);

Expand Down
34 changes: 22 additions & 12 deletions script/deploy/local/Deploy_From_Scratch.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -268,18 +268,28 @@ contract DeployFromScratch is Script, Test {
eigenLayerPauserReg
);
rewardsCoordinatorImplementation = new RewardsCoordinator(
delegation,
strategyManager,
allocationManager,
eigenLayerPauserReg,
permissionController,
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP
);
allocationManagerImplementation = new AllocationManager(delegation, eigenLayerPauserReg, permissionController, DEALLOCATION_DELAY, ALLOCATION_CONFIGURATION_DELAY);
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams(
delegation,
strategyManager,
allocationManager,
eigenLayerPauserReg,
permissionController,
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP,
EIP712_VERSION
)
);
allocationManagerImplementation = new AllocationManager(
delegation,
eigenLayerPauserReg,
permissionController,
DEALLOCATION_DELAY,
ALLOCATION_CONFIGURATION_DELAY,
EIP712_VERSION
);
permissionControllerImplementation = new PermissionController();

// Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them.
Expand Down
34 changes: 22 additions & 12 deletions script/deploy/local/deploy_from_scratch.slashing.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -263,18 +263,28 @@ contract DeployFromScratch is Script, Test {
eigenLayerPauserReg
);
rewardsCoordinatorImplementation = new RewardsCoordinator(
delegation,
strategyManager,
allocationManager,
eigenLayerPauserReg,
permissionController,
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP
);
allocationManagerImplementation = new AllocationManager(delegation, eigenLayerPauserReg, permissionController, DEALLOCATION_DELAY, ALLOCATION_CONFIGURATION_DELAY);
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams(
delegation,
strategyManager,
allocationManager,
eigenLayerPauserReg,
permissionController,
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP,
EIP712_VERSION
)
);
allocationManagerImplementation = new AllocationManager(
delegation,
eigenLayerPauserReg,
permissionController,
DEALLOCATION_DELAY,
ALLOCATION_CONFIGURATION_DELAY,
EIP712_VERSION
);
permissionControllerImplementation = new PermissionController();

// Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them.
Expand Down
30 changes: 17 additions & 13 deletions script/releases/v1.0.0-slashing/1-deployContracts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ contract Deploy is EOADeployer {
_pauserRegistry: Env.impl.pauserRegistry(),
_permissionController: Env.proxy.permissionController(),
_DEALLOCATION_DELAY: Env.MIN_WITHDRAWAL_DELAY(),
_ALLOCATION_CONFIGURATION_DELAY: Env.ALLOCATION_CONFIGURATION_DELAY()
_ALLOCATION_CONFIGURATION_DELAY: Env.ALLOCATION_CONFIGURATION_DELAY(),
_version: Env.version()
}))
});

Expand Down Expand Up @@ -99,18 +100,21 @@ contract Deploy is EOADeployer {

deployImpl({
name: type(RewardsCoordinator).name,
deployedTo: address(new RewardsCoordinator({
_delegationManager: Env.proxy.delegationManager(),
_strategyManager: Env.proxy.strategyManager(),
_allocationManager: Env.proxy.allocationManager(),
_pauserRegistry: Env.impl.pauserRegistry(),
_permissionController: Env.proxy.permissionController(),
_CALCULATION_INTERVAL_SECONDS: Env.CALCULATION_INTERVAL_SECONDS(),
_MAX_REWARDS_DURATION: Env.MAX_REWARDS_DURATION(),
_MAX_RETROACTIVE_LENGTH: Env.MAX_RETROACTIVE_LENGTH(),
_MAX_FUTURE_LENGTH: Env.MAX_FUTURE_LENGTH(),
_GENESIS_REWARDS_TIMESTAMP: Env.GENESIS_REWARDS_TIMESTAMP()
}))
deployedTo: address(new RewardsCoordinator(
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams({
delegationManager: Env.proxy.delegationManager(),
strategyManager: Env.proxy.strategyManager(),
allocationManager: Env.proxy.allocationManager(),
pauserRegistry: Env.impl.pauserRegistry(),
permissionController: Env.proxy.permissionController(),
CALCULATION_INTERVAL_SECONDS: Env.CALCULATION_INTERVAL_SECONDS(),
MAX_REWARDS_DURATION: Env.MAX_REWARDS_DURATION(),
MAX_RETROACTIVE_LENGTH: Env.MAX_RETROACTIVE_LENGTH(),
MAX_FUTURE_LENGTH: Env.MAX_FUTURE_LENGTH(),
GENESIS_REWARDS_TIMESTAMP: Env.GENESIS_REWARDS_TIMESTAMP(),
version: Env.version()
})
))
});

deployImpl({
Expand Down
3 changes: 2 additions & 1 deletion script/releases/v1.0.1-slashing/1-eoa.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ contract Deploy is EOADeployer {
_pauserRegistry: Env.impl.pauserRegistry(),
_permissionController: Env.proxy.permissionController(),
_DEALLOCATION_DELAY: Env.MIN_WITHDRAWAL_DELAY(),
_ALLOCATION_CONFIGURATION_DELAY: Env.ALLOCATION_CONFIGURATION_DELAY()
_ALLOCATION_CONFIGURATION_DELAY: Env.ALLOCATION_CONFIGURATION_DELAY(),
_version: Env.version()
}))
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ contract Deploy is EOADeployer {
_pauserRegistry: Env.impl.pauserRegistry(),
_permissionController: Env.proxy.permissionController(),
_DEALLOCATION_DELAY: Env.MIN_WITHDRAWAL_DELAY(),
_ALLOCATION_CONFIGURATION_DELAY: Env.ALLOCATION_CONFIGURATION_DELAY()
_ALLOCATION_CONFIGURATION_DELAY: Env.ALLOCATION_CONFIGURATION_DELAY(),
_version: Env.version()
}))
});

Expand Down Expand Up @@ -99,18 +100,21 @@ contract Deploy is EOADeployer {

deployImpl({
name: type(RewardsCoordinator).name,
deployedTo: address(new RewardsCoordinator({
_delegationManager: Env.proxy.delegationManager(),
_strategyManager: Env.proxy.strategyManager(),
_allocationManager: Env.proxy.allocationManager(),
_pauserRegistry: Env.impl.pauserRegistry(),
_permissionController: Env.proxy.permissionController(),
_CALCULATION_INTERVAL_SECONDS: Env.CALCULATION_INTERVAL_SECONDS(),
_MAX_REWARDS_DURATION: Env.MAX_REWARDS_DURATION(),
_MAX_RETROACTIVE_LENGTH: Env.MAX_RETROACTIVE_LENGTH(),
_MAX_FUTURE_LENGTH: Env.MAX_FUTURE_LENGTH(),
_GENESIS_REWARDS_TIMESTAMP: Env.GENESIS_REWARDS_TIMESTAMP()
}))
deployedTo: address(new RewardsCoordinator(
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams({
delegationManager: Env.proxy.delegationManager(),
strategyManager: Env.proxy.strategyManager(),
allocationManager: Env.proxy.allocationManager(),
pauserRegistry: Env.impl.pauserRegistry(),
permissionController: Env.proxy.permissionController(),
CALCULATION_INTERVAL_SECONDS: Env.CALCULATION_INTERVAL_SECONDS(),
MAX_REWARDS_DURATION: Env.MAX_REWARDS_DURATION(),
MAX_RETROACTIVE_LENGTH: Env.MAX_RETROACTIVE_LENGTH(),
MAX_FUTURE_LENGTH: Env.MAX_FUTURE_LENGTH(),
GENESIS_REWARDS_TIMESTAMP: Env.GENESIS_REWARDS_TIMESTAMP(),
version: Env.version()
})
))
});

deployImpl({
Expand Down
27 changes: 15 additions & 12 deletions script/releases/v1.0.3-slashing/1-eoa.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,21 @@ contract Deploy is EOADeployer {
// Deploy RC
deployImpl({
name: type(RewardsCoordinator).name,
deployedTo: address(new RewardsCoordinator({
_delegationManager: Env.proxy.delegationManager(),
_strategyManager: Env.proxy.strategyManager(),
_allocationManager: Env.proxy.allocationManager(),
_pauserRegistry: Env.impl.pauserRegistry(),
_permissionController: Env.proxy.permissionController(),
_CALCULATION_INTERVAL_SECONDS: Env.CALCULATION_INTERVAL_SECONDS(),
_MAX_REWARDS_DURATION: Env.MAX_REWARDS_DURATION(),
_MAX_RETROACTIVE_LENGTH: Env.MAX_RETROACTIVE_LENGTH(),
_MAX_FUTURE_LENGTH: Env.MAX_FUTURE_LENGTH(),
_GENESIS_REWARDS_TIMESTAMP: Env.GENESIS_REWARDS_TIMESTAMP()
}))
deployedTo: address(new RewardsCoordinator(
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams({
delegationManager: Env.proxy.delegationManager(),
strategyManager: Env.proxy.strategyManager(),
allocationManager: Env.proxy.allocationManager(),
pauserRegistry: Env.impl.pauserRegistry(),
permissionController: Env.proxy.permissionController(),
CALCULATION_INTERVAL_SECONDS: Env.CALCULATION_INTERVAL_SECONDS(),
MAX_REWARDS_DURATION: Env.MAX_REWARDS_DURATION(),
MAX_RETROACTIVE_LENGTH: Env.MAX_RETROACTIVE_LENGTH(),
MAX_FUTURE_LENGTH: Env.MAX_FUTURE_LENGTH(),
GENESIS_REWARDS_TIMESTAMP: Env.GENESIS_REWARDS_TIMESTAMP(),
version: Env.version()
})
))
});

vm.stopBroadcast();
Expand Down
6 changes: 5 additions & 1 deletion script/utils/ExistingDeploymentParser.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ contract ExistingDeploymentParser is Script, Logger {
/// EigenLayer Contract Parameters
/// -----------------------------------------------------------------------

string public EIP712_VERSION;
0xClandestine marked this conversation as resolved.
Show resolved Hide resolved
/// @dev AllocationManager
uint256 ALLOCATION_MANAGER_INIT_PAUSED_STATUS;
uint32 DEALLOCATION_DELAY;
Expand Down Expand Up @@ -193,6 +194,8 @@ contract ExistingDeploymentParser is Script, Logger {
// READ JSON CONFIG DATA
string memory json = cheats.readFile(existingDeploymentInfoPath);

EIP712_VERSION = stdJson.readString(json, ".parameters.version");

// check that the chainID matches the one in the config
uint256 configChainId = json.readUint(".chainInfo.chainId");
assertEq(configChainId, currentChainId, "You are on the wrong chain for this config");
Expand Down Expand Up @@ -221,7 +224,8 @@ contract ExistingDeploymentParser is Script, Logger {
eigenLayerPauserReg,
permissionController,
DEALLOCATION_DELAY,
ALLOCATION_CONFIGURATION_DELAY
ALLOCATION_CONFIGURATION_DELAY,
EIP712_VERSION
);
allocationManager = AllocationManager(
address(new TransparentUpgradeableProxy(address(allocationManagerImplementation), address(eigenLayerProxyAdmin), ""))
Expand Down
4 changes: 3 additions & 1 deletion src/contracts/core/AVSDirectory.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.27;

import "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol";
import "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin-upgrades/contracts/security/ReentrancyGuardUpgradeable.sol";

import "../mixins/SignatureUtilsMixin.sol";

import "../permissions/Pausable.sol";

import "./AVSDirectoryStorage.sol";

contract AVSDirectory is
Expand Down
17 changes: 12 additions & 5 deletions src/contracts/core/AllocationManager.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.27;

import "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol";
import "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin-upgrades/contracts/security/ReentrancyGuardUpgradeable.sol";

import "../libraries/OperatorSetLib.sol";
import "../libraries/SlashingLib.sol";

import "../mixins/PermissionControllerMixin.sol";
import "../mixins/SemVerMixin.sol";

import "../permissions/Pausable.sol";
import "../libraries/SlashingLib.sol";
import "../libraries/OperatorSetLib.sol";

import "./AllocationManagerStorage.sol";

contract AllocationManager is
Expand All @@ -17,7 +21,8 @@ contract AllocationManager is
Pausable,
AllocationManagerStorage,
ReentrancyGuardUpgradeable,
PermissionControllerMixin
PermissionControllerMixin,
SemVerMixin
{
using DoubleEndedQueue for DoubleEndedQueue.Bytes32Deque;
using EnumerableSet for *;
Expand All @@ -40,11 +45,13 @@ contract AllocationManager is
IPauserRegistry _pauserRegistry,
IPermissionController _permissionController,
uint32 _DEALLOCATION_DELAY,
uint32 _ALLOCATION_CONFIGURATION_DELAY
uint32 _ALLOCATION_CONFIGURATION_DELAY,
string memory _version
)
AllocationManagerStorage(_delegation, _DEALLOCATION_DELAY, _ALLOCATION_CONFIGURATION_DELAY)
Pausable(_pauserRegistry)
PermissionControllerMixin(_permissionController)
SemVerMixin(_version)
{
_disableInitializers();
}
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/core/AllocationManagerStorage.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.27;

import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/structs/DoubleEndedQueue.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

import "../interfaces/IAllocationManager.sol";
import "../interfaces/IDelegationManager.sol";
Expand Down
11 changes: 7 additions & 4 deletions src/contracts/core/DelegationManager.sol
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.27;

import "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol";
import "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin-upgrades/contracts/security/ReentrancyGuardUpgradeable.sol";

import "../mixins/SignatureUtilsMixin.sol";
import "../mixins/PermissionControllerMixin.sol";
import "../permissions/Pausable.sol";
import "../libraries/SlashingLib.sol";
import "../libraries/Snapshots.sol";

import "../mixins/PermissionControllerMixin.sol";
import "../mixins/SignatureUtilsMixin.sol";

import "../permissions/Pausable.sol";

import "./DelegationManagerStorage.sol";

/**
Expand Down
6 changes: 3 additions & 3 deletions src/contracts/core/DelegationManagerStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ pragma solidity ^0.8.27;
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

import "../libraries/SlashingLib.sol";
import {Snapshots} from "../libraries/Snapshots.sol";

import "../interfaces/IAllocationManager.sol";
import "../interfaces/IDelegationManager.sol";
import "../interfaces/IEigenPodManager.sol";
import "../interfaces/IAllocationManager.sol";

import {Snapshots} from "../libraries/Snapshots.sol";

/**
* @title Storage variables for the `DelegationManager` contract.
Expand Down
Loading
Loading