Skip to content

Commit

Permalink
Merge pull request #109 from zkLinkProtocol/abdk_audit_6_fix
Browse files Browse the repository at this point in the history
fix: abdk_audit_6_cvf_4
  • Loading branch information
zkbenny authored May 22, 2024
2 parents 51af4ef + c288e90 commit 00534d2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions contracts/ZkLink.sol
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,8 @@ contract ZkLink is
uint256 _toBatchNumber,
bytes32[] calldata _l2LogsRootHashes
) external onlyValidator {
// The first open or the next open
require(totalBatchesExecuted == 0 || _fromBatchNumber == totalBatchesExecuted + 1, "Invalid open");
require(_toBatchNumber >= _fromBatchNumber, "Invalid range");
bytes32 range = keccak256(abi.encodePacked(_fromBatchNumber, _toBatchNumber));
bytes32 rangeBatchRootHash = rangeBatchRootHashes[range];
Expand All @@ -511,9 +513,7 @@ contract ZkLink is
}
require(_rangeBatchRootHash == rangeBatchRootHash, "Incorrect root hash");
delete rangeBatchRootHashes[range];
if (_toBatchNumber > totalBatchesExecuted) {
totalBatchesExecuted = _toBatchNumber;
}
totalBatchesExecuted = _toBatchNumber;
emit OpenRangeBatchRoot(_fromBatchNumber, _toBatchNumber);
}

Expand Down

0 comments on commit 00534d2

Please sign in to comment.