diff --git a/contracts/src/core/EigenDAServiceManager.sol b/contracts/src/core/EigenDAServiceManager.sol index 074c210056..6099f6976b 100644 --- a/contracts/src/core/EigenDAServiceManager.sol +++ b/contracts/src/core/EigenDAServiceManager.sol @@ -80,6 +80,12 @@ contract EigenDAServiceManager is EigenDAServiceManagerStorage, ServiceManagerBa "EigenDAServiceManager.confirmBatch: specified referenceBlockNumber is too far in past" ); + //make sure that the quorumNumbers and quorumThresholdPercentages are of the same length + require( + batchHeader.quorumNumbers.length == batchHeader.quorumThresholdPercentages.length, + "EigenDAServiceManager.confirmBatch: quorumNumbers and quorumThresholdPercentages must be of the same length" + ); + // calculate reducedBatchHeaderHash which nodes signed bytes32 reducedBatchHeaderHash = batchHeader.hashBatchHeaderToReducedBatchHeader(); diff --git a/contracts/test/unit/EigenDAServiceManagerUnit.t.sol b/contracts/test/unit/EigenDAServiceManagerUnit.t.sol index 26d48c9cdc..301b43b5d9 100644 --- a/contracts/test/unit/EigenDAServiceManagerUnit.t.sol +++ b/contracts/test/unit/EigenDAServiceManagerUnit.t.sol @@ -168,7 +168,18 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer { assertEq(eigenDAServiceManager.batchId(), batchIdToConfirm + 1); } + function testConfirmBatch_Revert_LengthMismatch(uint256 pseudoRandomNumber) public { + (IEigenDAServiceManager.BatchHeader memory batchHeader, BLSSignatureChecker.NonSignerStakesAndSignature memory nonSignerStakesAndSignature) + = _getHeaderandNonSigners(0, pseudoRandomNumber, 100); + batchHeader.quorumThresholdPercentages = new bytes(0); + cheats.expectRevert(bytes("EigenDAServiceManager.confirmBatch: quorumNumbers and quorumThresholdPercentages must be of the same length")); + cheats.prank(confirmer, confirmer); + eigenDAServiceManager.confirmBatch( + batchHeader, + nonSignerStakesAndSignature + ); + } function _getHeaderandNonSigners(uint256 _nonSigners, uint256 _pseudoRandomNumber, uint8 _threshold) internal returns (IEigenDAServiceManager.BatchHeader memory, BLSSignatureChecker.NonSignerStakesAndSignature memory) { // register a bunch of operators