Skip to content

Commit

Permalink
onchain socket (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0aa0 authored Oct 31, 2024
1 parent 4922529 commit 177b51f
Show file tree
Hide file tree
Showing 16 changed files with 407 additions and 248 deletions.
2 changes: 1 addition & 1 deletion contracts/bindings/AVSDirectory/binding.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/bindings/BLSApkRegistry/binding.go

Large diffs are not rendered by default.

213 changes: 5 additions & 208 deletions contracts/bindings/DelegationManager/binding.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/bindings/EigenDAServiceManager/binding.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/bindings/EjectionManager/binding.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/bindings/IndexRegistry/binding.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/bindings/MockRollup/binding.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/bindings/OperatorStateRetriever/binding.go

Large diffs are not rendered by default.

39 changes: 35 additions & 4 deletions contracts/bindings/RegistryCoordinator/binding.go

Large diffs are not rendered by default.

338 changes: 338 additions & 0 deletions contracts/bindings/SocketRegistry/binding.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/bindings/StakeRegistry/binding.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function create_binding {
forge clean
forge build

contracts="AVSDirectory DelegationManager BitmapUtils OperatorStateRetriever RegistryCoordinator BLSApkRegistry IndexRegistry StakeRegistry BN254 EigenDAServiceManager IEigenDAServiceManager MockRollup EjectionManager"
contracts="SocketRegistry AVSDirectory DelegationManager BitmapUtils OperatorStateRetriever RegistryCoordinator BLSApkRegistry IndexRegistry StakeRegistry BN254 EigenDAServiceManager IEigenDAServiceManager MockRollup EjectionManager"
for contract in $contracts; do
create_binding ./ $contract ./bindings
done
Expand Down
23 changes: 0 additions & 23 deletions contracts/script/DeployOpenEigenLayer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.so
import "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";

import "eigenlayer-core/contracts/interfaces/IETHPOSDeposit.sol";
import "eigenlayer-core/contracts/interfaces/IBeaconChainOracle.sol";

import "eigenlayer-core/contracts/core/StrategyManager.sol";
import "eigenlayer-core/contracts/core/Slasher.sol";
Expand All @@ -19,7 +18,6 @@ import "eigenlayer-core/contracts/strategies/StrategyBaseTVLLimits.sol";

import "eigenlayer-core/contracts/pods/EigenPod.sol";
import "eigenlayer-core/contracts/pods/EigenPodManager.sol";
import "eigenlayer-core/contracts/pods/DelayedWithdrawalRouter.sol";

import "eigenlayer-core/contracts/permissions/PauserRegistry.sol";

Expand Down Expand Up @@ -64,8 +62,6 @@ contract DeployOpenEigenLayer is Script, Test {
StrategyManager public strategyManagerImplementation;
EigenPodManager public eigenPodManager;
EigenPodManager public eigenPodManagerImplementation;
DelayedWithdrawalRouter public delayedWithdrawalRouter;
DelayedWithdrawalRouter public delayedWithdrawalRouterImplementation;
AVSDirectory public avsDirectory;
AVSDirectory public avsDirectoryImplementation;
RewardsCoordinator public rewardsCoordinator;
Expand Down Expand Up @@ -123,20 +119,14 @@ contract DeployOpenEigenLayer is Script, Test {
eigenPodManager = EigenPodManager(
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), ""))
);
delayedWithdrawalRouter = DelayedWithdrawalRouter(
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), ""))
);
rewardsCoordinator = RewardsCoordinator(
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), ""))
);

// ETH POS deposit is 0 address
eigenPodImplementation = new EigenPod(
ethPOSDeposit,
delayedWithdrawalRouter,
eigenPodManager,
// uint64(MAX_VALIDATOR_BALANCE_GWEI),
uint64(32 gwei),
1000 // temp genesis time
);

Expand All @@ -163,7 +153,6 @@ contract DeployOpenEigenLayer is Script, Test {
slasher,
delegation
);
delayedWithdrawalRouterImplementation = new DelayedWithdrawalRouter(eigenPodManager);

// Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them.
IStrategy[] memory _strategies;
Expand Down Expand Up @@ -213,20 +202,8 @@ contract DeployOpenEigenLayer is Script, Test {
address(eigenPodManagerImplementation),
abi.encodeWithSelector(
EigenPodManager.initialize.selector,
IBeaconChainOracle(address(0)),
executorMultisig,
eigenLayerPauserReg,
0
)
);
eigenLayerProxyAdmin.upgradeAndCall(
TransparentUpgradeableProxy(payable(address(delayedWithdrawalRouter))),
address(delayedWithdrawalRouterImplementation),
abi.encodeWithSelector(
DelayedWithdrawalRouter.initialize.selector,
executorMultisig,
eigenLayerPauserReg,
0,
0
)
);
Expand Down
16 changes: 15 additions & 1 deletion contracts/script/EigenDADeployer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {IServiceManager} from "eigenlayer-middleware/interfaces/IServiceManager.
import {IBLSApkRegistry} from "eigenlayer-middleware/interfaces/IBLSApkRegistry.sol";
import {EigenDAServiceManager, IAVSDirectory, IRewardsCoordinator} from "../src/core/EigenDAServiceManager.sol";
import {EigenDAHasher} from "../src/libraries/EigenDAHasher.sol";
import {ISocketRegistry, SocketRegistry} from "eigenlayer-middleware/SocketRegistry.sol";

import {DeployOpenEigenLayer, ProxyAdmin, ERC20PresetFixedSupply, TransparentUpgradeableProxy, IPauserRegistry} from "./DeployOpenEigenLayer.s.sol";
import "forge-std/Test.sol";
Expand All @@ -36,13 +37,15 @@ contract EigenDADeployer is DeployOpenEigenLayer {
RegistryCoordinator public registryCoordinator;
IIndexRegistry public indexRegistry;
IStakeRegistry public stakeRegistry;
ISocketRegistry public socketRegistry;
OperatorStateRetriever public operatorStateRetriever;

BLSApkRegistry public apkRegistryImplementation;
EigenDAServiceManager public eigenDAServiceManagerImplementation;
IRegistryCoordinator public registryCoordinatorImplementation;
IIndexRegistry public indexRegistryImplementation;
IStakeRegistry public stakeRegistryImplementation;
ISocketRegistry public socketRegistryImplementation;

struct AddressConfig {
address eigenLayerCommunityMultisig;
Expand Down Expand Up @@ -110,6 +113,9 @@ contract EigenDADeployer is DeployOpenEigenLayer {
apkRegistry = BLSApkRegistry(
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenDAProxyAdmin), ""))
);
socketRegistry = ISocketRegistry(
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenDAProxyAdmin), ""))
);

indexRegistryImplementation = new IndexRegistry(
registryCoordinator
Expand Down Expand Up @@ -139,11 +145,19 @@ contract EigenDADeployer is DeployOpenEigenLayer {
address(apkRegistryImplementation)
);

socketRegistryImplementation = new SocketRegistry(registryCoordinator);

eigenDAProxyAdmin.upgrade(
TransparentUpgradeableProxy(payable(address(socketRegistry))),
address(socketRegistryImplementation)
);

registryCoordinatorImplementation = new RegistryCoordinator(
IServiceManager(address(eigenDAServiceManager)),
stakeRegistry,
apkRegistry,
indexRegistry
indexRegistry,
socketRegistry
);

{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
/*
pragma solidity ^0.8.12;
import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
Expand Down Expand Up @@ -32,7 +33,7 @@ import {EigenDAServiceManager} from "../../../src/core/EigenDAServiceManager.sol
* forge script script/deploy/holesky/EigenDASM_RewardsUpgrade.s.sol:ServiceManagerBaseUpgrade --rpc-url $RPC_HOLESKY --private-key $PRIVATE_KEY --broadcast --verify -vvvv --sig "run(string memory deployArg)" upgrade
* forge script script/deploy/holesky/EigenDASM_RewardsUpgrade.s.sol:ServiceManagerBaseUpgrade --rpc-url $RPC_HOLESKY --private-key $PRIVATE_KEY --broadcast --verify -vvvv --sig "run(string memory deployArg)" deploy
* forge script script/deploy/holesky/EigenDASM_RewardsUpgrade.s.sol:ServiceManagerBaseUpgrade --rpc-url $RPC_HOLESKY --private-key $PRIVATE_KEY --broadcast --verify -vvvv --sig "run(string memory deployArg)" createAVSRewardsSubmission
*/
*//*
contract ServiceManagerBaseUpgrade is ExistingDeploymentParser {
// Hardcode these values to your needs
address public serviceManager = 0x54A03db2784E3D0aCC08344D05385d0b62d4F432;
Expand Down Expand Up @@ -193,4 +194,5 @@ contract ServiceManagerBaseUpgrade is ExistingDeploymentParser {
"ServiceManagerBaseUpgrade: deployer address is incorrect"
);
}
}
}
*/

0 comments on commit 177b51f

Please sign in to comment.