Skip to content

Commit

Permalink
Fix merkle proof
Browse files Browse the repository at this point in the history
  • Loading branch information
gianbelinche committed Jan 6, 2025
1 parent 14b6fc6 commit 97842d6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions da-contracts/contracts/da-layers/eigenda/DummyEigenDABridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,29 @@ contract DummyEigenDABridge is IEigenDABridge {

function verifyBlobLeaf(MerkleProofInput calldata merkleProof) external view returns (bool) {
uint256 index = merkleProof.index;
require(merkleProof.inclusionProof.length % 32 == 0, "DummyEigenDABridge VerifyBlobLeaf: proof length should be a multiple of 32");
bytes memory inclusionProof = merkleProof.inclusionProof;
require(inclusionProof.length % 32 == 0, "DummyEigenDABridge VerifyBlobLeaf: proof length should be a multiple of 32");

Check failure on line 23 in da-contracts/contracts/da-layers/eigenda/DummyEigenDABridge.sol

View workflow job for this annotation

GitHub Actions / lint

Error message for require is too long: 74 counted / 32 allowed

Check failure on line 23 in da-contracts/contracts/da-layers/eigenda/DummyEigenDABridge.sol

View workflow job for this annotation

GitHub Actions / lint

GC: Use Custom Errors instead of require statements

Check failure on line 23 in da-contracts/contracts/da-layers/eigenda/DummyEigenDABridge.sol

View workflow job for this annotation

GitHub Actions / lint

Error message for require is too long: 74 counted / 32 allowed

Check failure on line 23 in da-contracts/contracts/da-layers/eigenda/DummyEigenDABridge.sol

View workflow job for this annotation

GitHub Actions / lint

GC: Use Custom Errors instead of require statements

Check failure on line 23 in da-contracts/contracts/da-layers/eigenda/DummyEigenDABridge.sol

View workflow job for this annotation

GitHub Actions / lint

Error message for require is too long: 74 counted / 32 allowed

Check failure on line 23 in da-contracts/contracts/da-layers/eigenda/DummyEigenDABridge.sol

View workflow job for this annotation

GitHub Actions / lint

GC: Use Custom Errors instead of require statements
bytes32 computedHash = merkleProof.leaf;
for (uint256 i = 32; i <= merkleProof.inclusionProof.length; i += 32) {
for (uint256 i = 32; i <= inclusionProof.length; i += 32) {

Check failure on line 25 in da-contracts/contracts/da-layers/eigenda/DummyEigenDABridge.sol

View workflow job for this annotation

GitHub Actions / lint

GC: Found [ .length ] property in Loop condition. Suggestion: assign it to a variable

Check failure on line 25 in da-contracts/contracts/da-layers/eigenda/DummyEigenDABridge.sol

View workflow job for this annotation

GitHub Actions / lint

GC: Found [ .length ] property in Loop condition. Suggestion: assign it to a variable

Check failure on line 25 in da-contracts/contracts/da-layers/eigenda/DummyEigenDABridge.sol

View workflow job for this annotation

GitHub Actions / lint

GC: Found [ .length ] property in Loop condition. Suggestion: assign it to a variable
if (index % 2 == 0) {
// if ith bit of index is 0, then computedHash is a left sibling
assembly {
mstore(0x00, computedHash)
mstore(0x20, mload(add(merkleProof.inclusionProof, i)))
mstore(0x20, mload(add(inclusionProof, i)))
computedHash := keccak256(0x00, 0x40)
index := div(index, 2)
}
} else {
// if ith bit of index is 1, then computedHash is a right sibling
assembly {
mstore(0x00, mload(add(merkleProof.inclusionProof, i)))
mstore(0x00, mload(add(inclusionProof, i)))
mstore(0x20, computedHash)
computedHash := keccak256(0x00, 0x40)
index := div(index, 2)
}
}
}
require(computedHash == merkleProof.batchRoot, "DummyEigenDABridge VerifyBlobLeaf: invalid proof");

Check failure on line 44 in da-contracts/contracts/da-layers/eigenda/DummyEigenDABridge.sol

View workflow job for this annotation

GitHub Actions / lint

Error message for require is too long: 48 counted / 32 allowed

Check failure on line 44 in da-contracts/contracts/da-layers/eigenda/DummyEigenDABridge.sol

View workflow job for this annotation

GitHub Actions / lint

GC: Use Custom Errors instead of require statements

Check failure on line 44 in da-contracts/contracts/da-layers/eigenda/DummyEigenDABridge.sol

View workflow job for this annotation

GitHub Actions / lint

Error message for require is too long: 48 counted / 32 allowed

Check failure on line 44 in da-contracts/contracts/da-layers/eigenda/DummyEigenDABridge.sol

View workflow job for this annotation

GitHub Actions / lint

GC: Use Custom Errors instead of require statements

Check failure on line 44 in da-contracts/contracts/da-layers/eigenda/DummyEigenDABridge.sol

View workflow job for this annotation

GitHub Actions / lint

Error message for require is too long: 48 counted / 32 allowed

Check failure on line 44 in da-contracts/contracts/da-layers/eigenda/DummyEigenDABridge.sol

View workflow job for this annotation

GitHub Actions / lint

GC: Use Custom Errors instead of require statements
return true;
}
}

0 comments on commit 97842d6

Please sign in to comment.