diff --git a/contracts/script/EigenDADeployer.s.sol b/contracts/script/EigenDADeployer.s.sol index 1b24709282..9e10f64124 100644 --- a/contracts/script/EigenDADeployer.s.sol +++ b/contracts/script/EigenDADeployer.s.sol @@ -24,6 +24,8 @@ import {IEigenDASignatureVerifier} from "../src/interfaces/IEigenDASignatureVeri import {IEigenDARelayRegistry} from "../src/interfaces/IEigenDARelayRegistry.sol"; import {IPaymentVault} from "../src/interfaces/IPaymentVault.sol"; import {PaymentVault} from "../src/payments/PaymentVault.sol"; +import {EigenDADisperserRegistry} from "../src/core/EigenDADisperserRegistry.sol"; +import {IEigenDADisperserRegistry} from "../src/interfaces/IEigenDADisperserRegistry.sol"; import {EigenDARelayRegistry} from "../src/core/EigenDARelayRegistry.sol"; import {ISocketRegistry, SocketRegistry} from "eigenlayer-middleware/SocketRegistry.sol"; import {DeployOpenEigenLayer, ProxyAdmin, ERC20PresetFixedSupply, TransparentUpgradeableProxy, IPauserRegistry} from "./DeployOpenEigenLayer.s.sol"; @@ -52,6 +54,7 @@ contract EigenDADeployer is DeployOpenEigenLayer { OperatorStateRetriever public operatorStateRetriever; IPaymentVault public paymentVault; EigenDARelayRegistry public eigenDARelayRegistry; + IEigenDADisperserRegistry public eigenDADisperserRegistry; BLSApkRegistry public apkRegistryImplementation; EigenDAServiceManager public eigenDAServiceManagerImplementation; @@ -62,6 +65,7 @@ contract EigenDADeployer is DeployOpenEigenLayer { EigenDARelayRegistry public eigenDARelayRegistryImplementation; ISocketRegistry public socketRegistryImplementation; IPaymentVault public paymentVaultImplementation; + IEigenDADisperserRegistry public eigenDADisperserRegistryImplementation; uint64 _minNumSymbols = 4096; uint64 _pricePerSymbol = 0.4470 gwei; @@ -150,6 +154,10 @@ contract EigenDADeployer is DeployOpenEigenLayer { address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenDAProxyAdmin), "")) ); + eigenDADisperserRegistry = IEigenDADisperserRegistry( + address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenDAProxyAdmin), "")) + ); + paymentVaultImplementation = new PaymentVault(); eigenDAProxyAdmin.upgradeAndCall( @@ -168,6 +176,17 @@ contract EigenDADeployer is DeployOpenEigenLayer { ); } + eigenDADisperserRegistryImplementation = new EigenDADisperserRegistry(); + + eigenDAProxyAdmin.upgradeAndCall( + TransparentUpgradeableProxy(payable(address(eigenDADisperserRegistry))), + address(eigenDADisperserRegistryImplementation), + abi.encodeWithSelector( + EigenDADisperserRegistry.initialize.selector, + addressConfig.eigenDACommunityMultisig + ) + ); + indexRegistryImplementation = new IndexRegistry( registryCoordinator ); @@ -256,7 +275,8 @@ contract EigenDADeployer is DeployOpenEigenLayer { stakeRegistry, eigenDAThresholdRegistry, eigenDARelayRegistry, - paymentVault + paymentVault, + eigenDADisperserRegistry ); address[] memory confirmers = new address[](1); diff --git a/contracts/src/core/EigenDADisperserRegistry.sol b/contracts/src/core/EigenDADisperserRegistry.sol new file mode 100644 index 0000000000..d21db3d6a2 --- /dev/null +++ b/contracts/src/core/EigenDADisperserRegistry.sol @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.9; + +import {OwnableUpgradeable} from "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol"; +import {EigenDADisperserRegistryStorage} from "./EigenDADisperserRegistryStorage.sol"; +import {IEigenDADisperserRegistry} from "../interfaces/IEigenDADisperserRegistry.sol"; +import "../interfaces/IEigenDAStructs.sol"; + +/** + * @title Registry for EigenDA disperser info + * @author Layr Labs, Inc. + */ +contract EigenDADisperserRegistry is OwnableUpgradeable, EigenDADisperserRegistryStorage, IEigenDADisperserRegistry { + + constructor() { + _disableInitializers(); + } + + function initialize( + address _initialOwner + ) external initializer { + _transferOwnership(_initialOwner); + } + + function setDisperserInfo(uint32 _disperserKey, DisperserInfo memory _disperserInfo) external onlyOwner { + disperserKeyToInfo[_disperserKey] = _disperserInfo; + emit DisperserAdded(_disperserKey, _disperserInfo.disperserAddress); + } + + function disperserKeyToAddress(uint32 _key) external view returns (address) { + return disperserKeyToInfo[_key].disperserAddress; + } +} diff --git a/contracts/src/core/EigenDADisperserRegistryStorage.sol b/contracts/src/core/EigenDADisperserRegistryStorage.sol new file mode 100644 index 0000000000..203581adac --- /dev/null +++ b/contracts/src/core/EigenDADisperserRegistryStorage.sol @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.9; + +import "../interfaces/IEigenDAStructs.sol"; + +/** + * @title Storage variables for the `EigenDADisperserRegistry` contract. + * @author Layr Labs, Inc. + * @notice This storage contract is separate from the logic to simplify the upgrade process. + */ +abstract contract EigenDADisperserRegistryStorage { + + mapping(uint32 => DisperserInfo) public disperserKeyToInfo; + + // storage gap for upgradeability + // slither-disable-next-line shadowing-state + uint256[49] private __GAP; +} \ No newline at end of file diff --git a/contracts/src/core/EigenDAServiceManager.sol b/contracts/src/core/EigenDAServiceManager.sol index fab05d0501..1d76358bf1 100644 --- a/contracts/src/core/EigenDAServiceManager.sol +++ b/contracts/src/core/EigenDAServiceManager.sol @@ -11,6 +11,7 @@ import {IStakeRegistry} from "eigenlayer-middleware/interfaces/IStakeRegistry.so import {IEigenDAThresholdRegistry} from "../interfaces/IEigenDAThresholdRegistry.sol"; import {IEigenDARelayRegistry} from "../interfaces/IEigenDARelayRegistry.sol"; import {IPaymentVault} from "../interfaces/IPaymentVault.sol"; +import {IEigenDADisperserRegistry} from "../interfaces/IEigenDADisperserRegistry.sol"; import {EigenDAServiceManagerStorage} from "./EigenDAServiceManagerStorage.sol"; import {EigenDAHasher} from "../libraries/EigenDAHasher.sol"; import "../interfaces/IEigenDAStructs.sol"; @@ -42,11 +43,12 @@ contract EigenDAServiceManager is EigenDAServiceManagerStorage, ServiceManagerBa IStakeRegistry __stakeRegistry, IEigenDAThresholdRegistry __eigenDAThresholdRegistry, IEigenDARelayRegistry __eigenDARelayRegistry, - IPaymentVault __paymentVault + IPaymentVault __paymentVault, + IEigenDADisperserRegistry __eigenDADisperserRegistry ) BLSSignatureChecker(__registryCoordinator) ServiceManagerBase(__avsDirectory, __rewardsCoordinator, __registryCoordinator, __stakeRegistry) - EigenDAServiceManagerStorage(__eigenDAThresholdRegistry, __eigenDARelayRegistry, __paymentVault) + EigenDAServiceManagerStorage(__eigenDAThresholdRegistry, __eigenDARelayRegistry, __paymentVault, __eigenDADisperserRegistry) { _disableInitializers(); } diff --git a/contracts/src/core/EigenDAServiceManagerStorage.sol b/contracts/src/core/EigenDAServiceManagerStorage.sol index 3a04661d99..b482c7b201 100644 --- a/contracts/src/core/EigenDAServiceManagerStorage.sol +++ b/contracts/src/core/EigenDAServiceManagerStorage.sol @@ -5,6 +5,7 @@ import {IEigenDAServiceManager} from "../interfaces/IEigenDAServiceManager.sol"; import {IEigenDAThresholdRegistry} from "../interfaces/IEigenDAThresholdRegistry.sol"; import {IEigenDARelayRegistry} from "../interfaces/IEigenDARelayRegistry.sol"; import {IPaymentVault} from "../interfaces/IPaymentVault.sol"; +import {IEigenDADisperserRegistry} from "../interfaces/IEigenDADisperserRegistry.sol"; /** * @title Storage variables for the `EigenDAServiceManager` contract. @@ -41,15 +42,18 @@ abstract contract EigenDAServiceManagerStorage is IEigenDAServiceManager { IEigenDAThresholdRegistry public immutable eigenDAThresholdRegistry; IEigenDARelayRegistry public immutable eigenDARelayRegistry; IPaymentVault public immutable paymentVault; + IEigenDADisperserRegistry public immutable eigenDADisperserRegistry; constructor( IEigenDAThresholdRegistry _eigenDAThresholdRegistry, IEigenDARelayRegistry _eigenDARelayRegistry, - IPaymentVault _paymentVault + IPaymentVault _paymentVault, + IEigenDADisperserRegistry _eigenDADisperserRegistry ) { eigenDAThresholdRegistry = _eigenDAThresholdRegistry; eigenDARelayRegistry = _eigenDARelayRegistry; paymentVault = _paymentVault; + eigenDADisperserRegistry = _eigenDADisperserRegistry; } /// @notice The current batchId diff --git a/contracts/src/interfaces/IEigenDADisperserRegistry.sol b/contracts/src/interfaces/IEigenDADisperserRegistry.sol new file mode 100644 index 0000000000..ac22dc04df --- /dev/null +++ b/contracts/src/interfaces/IEigenDADisperserRegistry.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.9; + +import "./IEigenDAStructs.sol"; + +interface IEigenDADisperserRegistry { + + event DisperserAdded(uint32 indexed key, address indexed disperser); + + function setDisperserInfo(uint32 _disperserKey, DisperserInfo memory _disperserInfo) external; + + function disperserKeyToAddress(uint32 key) external view returns (address); +} \ No newline at end of file diff --git a/contracts/src/interfaces/IEigenDAStructs.sol b/contracts/src/interfaces/IEigenDAStructs.sol index 5413929dba..e1f8dc784d 100644 --- a/contracts/src/interfaces/IEigenDAStructs.sol +++ b/contracts/src/interfaces/IEigenDAStructs.sol @@ -62,6 +62,10 @@ struct RelayInfo { string relayURL; } +struct DisperserInfo { + address disperserAddress; +} + struct BlobVerificationProofV2 { BlobCertificate blobCertificate; uint32 blobIndex; diff --git a/contracts/test/rollup/MockRollup.t.sol b/contracts/test/rollup/MockRollup.t.sol index aa37291b2e..8f9a24d7f9 100644 --- a/contracts/test/rollup/MockRollup.t.sol +++ b/contracts/test/rollup/MockRollup.t.sol @@ -20,6 +20,7 @@ import {IEigenDARelayRegistry} from "../../src/interfaces/IEigenDARelayRegistry. import {IPaymentVault} from "../../src/interfaces/IPaymentVault.sol"; import {EigenDARelayRegistry} from "../../src/core/EigenDARelayRegistry.sol"; import {IRegistryCoordinator} from "../../lib/eigenlayer-middleware/src/interfaces/IRegistryCoordinator.sol"; +import {IEigenDADisperserRegistry} from "../../src/interfaces/IEigenDADisperserRegistry.sol"; import "../../src/interfaces/IEigenDAStructs.sol"; import "forge-std/StdStorage.sol"; @@ -96,7 +97,8 @@ contract MockRollupTest is BLSMockAVSDeployer { stakeRegistry, eigenDAThresholdRegistry, eigenDARelayRegistry, - IPaymentVault(address(0)) + IPaymentVault(address(0)), + IEigenDADisperserRegistry(address(0)) ); eigenDAThresholdRegistryImplementation = new EigenDAThresholdRegistry(); diff --git a/contracts/test/unit/EigenDABlobUtils.t.sol b/contracts/test/unit/EigenDABlobUtils.t.sol index 5e5d326c69..25f5c032b3 100644 --- a/contracts/test/unit/EigenDABlobUtils.t.sol +++ b/contracts/test/unit/EigenDABlobUtils.t.sol @@ -19,6 +19,7 @@ import {IEigenDARelayRegistry} from "../../src/interfaces/IEigenDARelayRegistry. import {EigenDARelayRegistry} from "../../src/core/EigenDARelayRegistry.sol"; import {IPaymentVault} from "../../src/interfaces/IPaymentVault.sol"; import {PaymentVault} from "../../src/payments/PaymentVault.sol"; +import {IEigenDADisperserRegistry} from "../../src/interfaces/IEigenDADisperserRegistry.sol"; import "../../src/interfaces/IEigenDAStructs.sol"; import "forge-std/StdStorage.sol"; @@ -82,7 +83,8 @@ contract EigenDABlobUtilsUnit is BLSMockAVSDeployer { stakeRegistry, eigenDAThresholdRegistry, eigenDARelayRegistry, - IPaymentVault(address(0)) + IPaymentVault(address(0)), + IEigenDADisperserRegistry(address(0)) ); eigenDAThresholdRegistryImplementation = new EigenDAThresholdRegistry(); diff --git a/contracts/test/unit/EigenDAServiceManagerUnit.t.sol b/contracts/test/unit/EigenDAServiceManagerUnit.t.sol index b476494d5c..8c14a98c0c 100644 --- a/contracts/test/unit/EigenDAServiceManagerUnit.t.sol +++ b/contracts/test/unit/EigenDAServiceManagerUnit.t.sol @@ -16,6 +16,7 @@ import {IRegistryCoordinator} from "../../lib/eigenlayer-middleware/src/interfac import {IEigenDARelayRegistry} from "../../src/interfaces/IEigenDARelayRegistry.sol"; import {IPaymentVault} from "../../src/interfaces/IPaymentVault.sol"; import {EigenDARelayRegistry} from "../../src/core/EigenDARelayRegistry.sol"; +import {IEigenDADisperserRegistry} from "../../src/interfaces/IEigenDADisperserRegistry.sol"; import "../../src/interfaces/IEigenDAStructs.sol"; contract EigenDAServiceManagerUnit is BLSMockAVSDeployer { @@ -77,7 +78,8 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer { stakeRegistry, eigenDAThresholdRegistry, eigenDARelayRegistry, - IPaymentVault(address(0)) + IPaymentVault(address(0)), + IEigenDADisperserRegistry(address(0)) ); address[] memory confirmers = new address[](1);