From aec2b24ae693a3381653c7b718c829034d879393 Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Mon, 30 Sep 2024 18:36:29 -0300 Subject: [PATCH] Add ownable to verifier --- l1-contracts/contracts/eigenda/EigenDAVerifier.sol | 13 ++++++++++--- l1-contracts/deploy-scripts/DeployL1.s.sol | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/l1-contracts/contracts/eigenda/EigenDAVerifier.sol b/l1-contracts/contracts/eigenda/EigenDAVerifier.sol index 7a628c220..0b960a270 100644 --- a/l1-contracts/contracts/eigenda/EigenDAVerifier.sol +++ b/l1-contracts/contracts/eigenda/EigenDAVerifier.sol @@ -3,23 +3,30 @@ pragma solidity ^0.8.9; import {EigenDARollupUtils} from "@eigenda/eigenda-utils/libraries/EigenDARollupUtils.sol"; import {IEigenDAServiceManager} from "@eigenda/eigenda-utils/interfaces/IEigenDAServiceManager.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; -contract EigenDAVerifier { +contract EigenDAVerifier is Ownable { struct BlobInfo { IEigenDAServiceManager.BlobHeader blobHeader; EigenDARollupUtils.BlobVerificationProof blobVerificationProof; } - IEigenDAServiceManager public immutable EIGEN_DA_SERVICE_MANAGER; + IEigenDAServiceManager public EIGEN_DA_SERVICE_MANAGER; - constructor(address _eigenDAServiceManager) { + constructor(address _initialOwner, address _eigenDAServiceManager) { + _transferOwnership(_initialOwner); + EIGEN_DA_SERVICE_MANAGER = IEigenDAServiceManager(_eigenDAServiceManager); + } + + function setServiceManager(address _eigenDAServiceManager) external onlyOwner { EIGEN_DA_SERVICE_MANAGER = IEigenDAServiceManager(_eigenDAServiceManager); } function verifyBlob( BlobInfo calldata blobInfo ) external view { + require(address(EIGEN_DA_SERVICE_MANAGER) != address(0), "EigenDAVerifier: EIGEN_DA_SERVICE_MANAGER not set"); EigenDARollupUtils.verifyBlob(blobInfo.blobHeader, EIGEN_DA_SERVICE_MANAGER, blobInfo.blobVerificationProof); } } diff --git a/l1-contracts/deploy-scripts/DeployL1.s.sol b/l1-contracts/deploy-scripts/DeployL1.s.sol index 5ddc15791..2b7ad4a95 100644 --- a/l1-contracts/deploy-scripts/DeployL1.s.sol +++ b/l1-contracts/deploy-scripts/DeployL1.s.sol @@ -288,7 +288,7 @@ contract DeployL1Script is Script { function deployEigenDAVerifier() internal { bytes memory bytecode = abi.encodePacked( type(EigenDAVerifier).creationCode, - abi.encode(config.contracts.eigenServiceManager) + abi.encode(config.deployerAddress,config.contracts.eigenServiceManager) ); address contractAddress = deployViaCreate2(bytecode); console.log("EigenDAVerifier deployed at:", contractAddress);