diff --git a/l1-contracts/deploy-scripts/DeployL1.s.sol b/l1-contracts/deploy-scripts/DeployL1.s.sol index 2b9392319..487ec52a8 100644 --- a/l1-contracts/deploy-scripts/DeployL1.s.sol +++ b/l1-contracts/deploy-scripts/DeployL1.s.sol @@ -176,6 +176,15 @@ contract DeployL1Script is Script, DeployUtils { ); } + function getEigenDAL2ValidatorAddress() internal returns (address) { + return + Utils.getL2AddressViaCreate2Factory( + bytes32(0), + L2ContractHelper.hashL2Bytecode(L2ContractsBytecodesLib.readEigenDAL2ValidatorBytecode()), + hex"" + ); + } + function deployDAValidators() internal { vm.broadcast(msg.sender); address rollupDAManager = address(new RollupDAManager()); @@ -203,10 +212,7 @@ contract DeployL1Script is Script, DeployUtils { } if (config.contracts.eigenDAL1Validator == address(0)) { - addresses.daAddresses.eigenDAL1Validator = deployViaCreate2( - Utils.readEigenDAL1ValidatorBytecode(), - "" - ); + addresses.daAddresses.eigenDAL1Validator = deployViaCreate2(Utils.readEigenDAL1ValidatorBytecode(), ""); console.log("EigenDAL1Validator deployed at:", addresses.daAddresses.eigenDAL1Validator); } else { addresses.daAddresses.eigenDAL1Validator = config.contracts.eigenDAL1Validator; @@ -740,6 +746,7 @@ contract DeployL1Script is Script, DeployUtils { vm.serializeAddress("root", "expected_rollup_l2_da_validator_addr", getRollupL2ValidatorAddress()); vm.serializeAddress("root", "expected_no_da_validium_l2_validator_addr", getNoDAValidiumL2ValidatorAddress()); vm.serializeAddress("root", "expected_avail_l2_da_validator_addr", getAvailL2ValidatorAddress()); + vm.serializeAddress("root", "expected_eigenda_l2_validator_addr", getEigenDAL2ValidatorAddress()); string memory toml = vm.serializeAddress("root", "owner_address", config.ownerAddress); vm.writeToml(toml, outputPath); diff --git a/l1-contracts/deploy-scripts/DeployL2Contracts.sol b/l1-contracts/deploy-scripts/DeployL2Contracts.sol index fab4e3dd0..d5f4529db 100644 --- a/l1-contracts/deploy-scripts/DeployL2Contracts.sol +++ b/l1-contracts/deploy-scripts/DeployL2Contracts.sol @@ -170,7 +170,7 @@ contract DeployL2Script is Script { } else if (config.validatorType == DAValidatorType.Avail) { bytecode = L2ContractsBytecodesLib.readAvailL2DAValidatorBytecode(); } else if (config.validatorType == DAValidatorType.EigenDA) { - bytecode = L2ContractsBytecodesLib.readNoDAL2DAValidatorBytecode(); // TODO: update to EigenDA + bytecode = L2ContractsBytecodesLib.readEigenDAL2ValidatorBytecode(); } else { revert("Invalid DA validator type"); } diff --git a/l1-contracts/deploy-scripts/L2ContractsBytecodesLib.sol b/l1-contracts/deploy-scripts/L2ContractsBytecodesLib.sol index e0644d220..51914dba3 100644 --- a/l1-contracts/deploy-scripts/L2ContractsBytecodesLib.sol +++ b/l1-contracts/deploy-scripts/L2ContractsBytecodesLib.sol @@ -82,6 +82,12 @@ library L2ContractsBytecodesLib { return Utils.readZKFoundryBytecodeL2("AvailL2DAValidator.sol", "AvailL2DAValidator"); } + /// @notice Reads the bytecode of the ValidiumL2DAValidator contract for EigenDA. + /// @return The bytecode of the ValidiumL2DAValidator contract. + function readEigenDAL2ValidatorBytecode() internal view returns (bytes memory) { + return Utils.readZKFoundryBytecodeL2("EigenDAL2Validator.sol", "EigenDAL2Validator"); + } + /// @notice Reads the bytecode of the ValidiumL2DAValidator contract for NoDA validium. /// @return The bytecode of the ValidiumL2DAValidator contract. function readNoDAL2DAValidatorBytecode() internal view returns (bytes memory) { diff --git a/l2-contracts/contracts/data-availability/EigenDAL2Validator.sol b/l2-contracts/contracts/data-availability/EigenDAL2Validator.sol new file mode 100644 index 000000000..567849494 --- /dev/null +++ b/l2-contracts/contracts/data-availability/EigenDAL2Validator.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.24; + +import {IL2DAValidator} from "../interfaces/IL2DAValidator.sol"; + +/// Rollup DA validator. It will publish data that would allow to use either calldata or blobs. +contract EigenDAL2Validator is IL2DAValidator { + function validatePubdata( + // The rolling hash of the user L2->L1 logs. + bytes32, + // The root hash of the user L2->L1 logs. + bytes32, + // The chained hash of the L2->L1 messages + bytes32, + // The chained hash of uncompressed bytecodes sent to L1 + bytes32, + // Operator data, that is related to the DA itself + bytes calldata + ) external returns (bytes32 outputHash) { + // Since we do not need to publish anything to L1, we can just return 0. + // Note, that Rollup validator sends the hash of uncompressed state diffs, since the + // correctness of the publish pubdata depends on it. However Validium doesn't sent anything, + // so we don't need to publish even that. + // TODO: Implement real validation logic. + outputHash = bytes32(0); + } +}