Skip to content

Commit

Permalink
fix: V2 merkle check (#998)
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0aa0 authored Dec 13, 2024
1 parent cfdf4fd commit df2a330
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions contracts/src/libraries/EigenDABlobVerificationUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
15 changes: 14 additions & 1 deletion contracts/src/libraries/EigenDAHasher.sol
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,17 @@ library EigenDAHasher {
)
);
}
}

/**
* @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
)
);
}
}

0 comments on commit df2a330

Please sign in to comment.