@@ -5,55 +5,23 @@ pragma solidity 0.8.24;
5
5
import {IEigenDABridge} from "./IEigenDABridge.sol " ;
6
6
import {IImplementation} from "./IImplementation.sol " ;
7
7
import {DummyImplementation} from "./DummyImplementation.sol " ;
8
- import {IEigenDABatchMetadataStorage } from "@eigenda/eigenda-utils/interfaces/IEigenDABatchMetadataStorage .sol " ;
8
+ import {IBlobVerifier } from "./IBlobVerifier .sol " ;
9
9
10
10
contract DummyEigenDABridge is IEigenDABridge {
11
11
IImplementation public implementationContract;
12
- IEigenDABatchMetadataStorage public eigenDaServiceManager ;
12
+ IBlobVerifier public eigenBlobVerifier ;
13
13
14
- constructor (address _eigenDaServiceManager ) {
14
+ constructor (address _eigenBlobVerifier ) {
15
15
implementationContract = new DummyImplementation ();
16
- eigenDaServiceManager = IEigenDABatchMetadataStorage (_eigenDaServiceManager );
16
+ eigenBlobVerifier = IBlobVerifier (_eigenBlobVerifier );
17
17
}
18
18
19
19
function implementation () external view returns (IImplementation) {
20
20
return implementationContract;
21
21
}
22
22
23
- function hashBatchMetadata (BatchMetadata calldata batchMetadata ) external pure returns (bytes32 ) {
24
- return keccak256 (abi.encodePacked (keccak256 (abi.encode (batchMetadata.batchHeader)),batchMetadata.signatoryRecordHash,batchMetadata.confirmationBlockNumber));
25
- }
26
-
27
23
function verifyBlobLeaf (MerkleProofInput calldata merkleProof ) external view returns (bool ) {
28
- // Inspired by eigenlayer contracts Merkle.verifyInclusionKeccak
29
- // https://github.com/Layr-Labs/eigenlayer-contracts/blob/3f3f83bd194b3bdc77d06d8fe6b101fafc3bcfd5/src/contracts/libraries/Merkle.sol
30
- bytes32 hashedBatchMetadata = this .hashBatchMetadata (merkleProof.blobVerificationProof.batchMetadata);
31
- require (hashedBatchMetadata == IEigenDABatchMetadataStorage (eigenDaServiceManager).batchIdToBatchMetadataHash (merkleProof.blobVerificationProof.batchId), "invalid batch metadata " );
32
- uint256 index = merkleProof.blobVerificationProof.blobIndex;
33
- bytes memory inclusionProof = merkleProof.blobVerificationProof.inclusionProof;
34
- require (inclusionProof.length % 32 == 0 , "proof length not multiple of 32 " );
35
- bytes32 computedHash = merkleProof.leaf;
36
- uint256 length = inclusionProof.length ;
37
- for (uint256 i = 32 ; i <= length; i += 32 ) {
38
- if (index % 2 == 0 ) {
39
- // if ith bit of index is 0, then computedHash is a left sibling
40
- assembly {
41
- mstore (0x00 , computedHash)
42
- mstore (0x20 , mload (add (inclusionProof, i)))
43
- computedHash := keccak256 (0x00 , 0x40 )
44
- index := div (index, 2 )
45
- }
46
- } else {
47
- // if ith bit of index is 1, then computedHash is a right sibling
48
- assembly {
49
- mstore (0x00 , mload (add (inclusionProof, i)))
50
- mstore (0x20 , computedHash)
51
- computedHash := keccak256 (0x00 , 0x40 )
52
- index := div (index, 2 )
53
- }
54
- }
55
- }
56
- require (computedHash == merkleProof.blobVerificationProof.batchMetadata.batchHeader.blobHeadersRoot, "invalid proof " );
24
+ eigenBlobVerifier.verifyBlobV1 (merkleProof.blobHeader, merkleProof.blobVerificationProof);
57
25
return true ;
58
26
}
59
27
}
0 commit comments