From df2a330f91a499b1a9b3e45dd500e0c2d1721263 Mon Sep 17 00:00:00 2001 From: quaq <56312047+0x0aa0@users.noreply.github.com> Date: Fri, 13 Dec 2024 11:10:06 -0600 Subject: [PATCH] fix: V2 merkle check (#998) --- .../libraries/EigenDABlobVerificationUtils.sol | 4 ++-- contracts/src/libraries/EigenDAHasher.sol | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/contracts/src/libraries/EigenDABlobVerificationUtils.sol b/contracts/src/libraries/EigenDABlobVerificationUtils.sol index 0a08de8844..d13bf88ccd 100644 --- a/contracts/src/libraries/EigenDABlobVerificationUtils.sol +++ b/contracts/src/libraries/EigenDABlobVerificationUtils.sol @@ -173,7 +173,7 @@ library EigenDABlobVerificationUtils { Merkle.verifyInclusionKeccak( blobVerificationProof.inclusionProof, batchHeader.batchRoot, - keccak256(abi.encodePacked(EigenDAHasher.hashBlobHeaderV2(blobVerificationProof.blobCertificate.blobHeader))), + keccak256(abi.encodePacked(EigenDAHasher.hashBlobCertificate(blobVerificationProof.blobCertificate))), blobVerificationProof.blobIndex ), "EigenDABlobVerificationUtils._verifyBlobV2ForQuorums: inclusion proof is invalid" @@ -242,7 +242,7 @@ library EigenDABlobVerificationUtils { Merkle.verifyInclusionKeccak( blobVerificationProof.inclusionProof, batchHeader.batchRoot, - keccak256(abi.encodePacked(EigenDAHasher.hashBlobHeaderV2(blobVerificationProof.blobCertificate.blobHeader))), + keccak256(abi.encodePacked(EigenDAHasher.hashBlobCertificate(blobVerificationProof.blobCertificate))), blobVerificationProof.blobIndex ), "EigenDABlobVerificationUtils._verifyBlobV2ForQuorums: inclusion proof is invalid" diff --git a/contracts/src/libraries/EigenDAHasher.sol b/contracts/src/libraries/EigenDAHasher.sol index ca517296bf..0f081012ae 100644 --- a/contracts/src/libraries/EigenDAHasher.sol +++ b/contracts/src/libraries/EigenDAHasher.sol @@ -130,4 +130,17 @@ library EigenDAHasher { ) ); } -} \ No newline at end of file + + /** + * @notice hashes the given V2 blob certificate + * @param blobCertificate the V2 blob certificate to hash + */ + function hashBlobCertificate(BlobCertificate memory blobCertificate) internal pure returns(bytes32) { + return keccak256( + abi.encode( + hashBlobHeaderV2(blobCertificate.blobHeader), + blobCertificate.relayKeys + ) + ); + } +}