Skip to content

Commit

Permalink
Add hash batch metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
gianbelinche committed Jan 7, 2025
1 parent da387dd commit 18982e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ contract DummyEigenDABridge is IEigenDABridge {
return implementationContract;
}

function hashBatchMetadata(BatchMetadata calldata batchMetadata) external pure returns (bytes32) {
return keccak256(abi.encodePacked(keccak256(abi.encode(batchMetadata.batchHeader)),batchMetadata.signatoryRecordHash,batchMetadata.confirmationBlockNumber));
}

function verifyBlobLeaf(MerkleProofInput calldata merkleProof) external view returns (bool) {
// Inspired by eigenlayer contracts Merkle.verifyInclusionKeccak
// https://github.com/Layr-Labs/eigenlayer-contracts/blob/3f3f83bd194b3bdc77d06d8fe6b101fafc3bcfd5/src/contracts/libraries/Merkle.sol
bytes32 hashedBatchMetadata = this.hashBatchMetadata(merkleProof.blobVerificationProof.batchMetadata);
uint256 index = merkleProof.blobVerificationProof.blobIndex;
bytes memory inclusionProof = merkleProof.blobVerificationProof.inclusionProof;
require(inclusionProof.length % 32 == 0, "proof length not multiple of 32");
Expand Down
6 changes: 5 additions & 1 deletion da-contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ libs = ['node_modules', 'lib']
remappings = [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"l2-contracts/=../l2-contracts/contracts/"
"l2-contracts/=../l2-contracts/contracts/",
"@eigenda/eigenda-utils/libraries/=lib/eigenda/contracts/src/libraries/",
"@eigenda/eigenda-utils/interfaces/=lib/eigenda/contracts/src/interfaces/",
"eigenlayer-middleware/=lib/eigenda/contracts/lib/eigenlayer-middleware/src/",
"eigenlayer-core/=lib/eigenda/contracts/lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/"
]
allow_paths = ["../l2-contracts/contracts"]
fs_permissions = [
Expand Down

0 comments on commit 18982e2

Please sign in to comment.