diff --git a/contracts/src/core/EigenDAServiceManagerStorage.sol b/contracts/src/core/EigenDAServiceManagerStorage.sol index a5b687c675..7cf6900e3a 100644 --- a/contracts/src/core/EigenDAServiceManagerStorage.sol +++ b/contracts/src/core/EigenDAServiceManagerStorage.sol @@ -26,10 +26,16 @@ abstract contract EigenDAServiceManagerStorage is IEigenDAServiceManager { */ uint32 public constant BLOCK_STALE_MEASURE = 150; - /// @notice The quorum adversary threshold percentages + /** + * @notice The quorum adversary threshold percentages stored as an ordered bytes array + * this is the percentage of the total stake that must be adversarial to consider a blob invalid + */ bytes public constant quorumAdversaryThresholdPercentages = hex"2121"; - /// @notice The quorum confirmation threshold percentages + /** + * @notice The quorum confirmation threshold percentages stored as an ordered bytes array + * this is the percentage of the total stake needed to confirm a blob + */ bytes public constant quorumConfirmationThresholdPercentages = hex"4242"; /// @notice The current batchId diff --git a/contracts/src/libraries/EigenDARollupUtils.sol b/contracts/src/libraries/EigenDARollupUtils.sol index f68be7f0c4..2826319969 100644 --- a/contracts/src/libraries/EigenDARollupUtils.sol +++ b/contracts/src/libraries/EigenDARollupUtils.sol @@ -20,7 +20,7 @@ library EigenDARollupUtils { uint8 blobIndex; IEigenDAServiceManager.BatchMetadata batchMetadata; bytes inclusionProof; - bytes quorumThresholdIndexes; + bytes quorumIndices; } /** @@ -53,7 +53,7 @@ library EigenDARollupUtils { // require that the security param in each blob is met for (uint i = 0; i < blobHeader.quorumBlobParams.length; i++) { // make sure that the quorumIndex matches the given quorumNumber - require(uint8(blobVerificationProof.batchMetadata.batchHeader.quorumNumbers[uint8(blobVerificationProof.quorumThresholdIndexes[i])]) == blobHeader.quorumBlobParams[i].quorumNumber, + require(uint8(blobVerificationProof.batchMetadata.batchHeader.quorumNumbers[uint8(blobVerificationProof.quorumIndices[i])]) == blobHeader.quorumBlobParams[i].quorumNumber, "EigenDARollupUtils.verifyBlob: quorumNumber does not match" ); @@ -72,7 +72,7 @@ library EigenDARollupUtils { } // make sure that the stake signed for is greater than the given confirmationThresholdPercentage - require(uint8(blobVerificationProof.batchMetadata.batchHeader.signedStakeForQuorums[uint8(blobVerificationProof.quorumThresholdIndexes[i])]) + require(uint8(blobVerificationProof.batchMetadata.batchHeader.signedStakeForQuorums[uint8(blobVerificationProof.quorumIndices[i])]) >= blobHeader.quorumBlobParams[i].confirmationThresholdPercentage, "EigenDARollupUtils.verifyBlob: confirmationThresholdPercentage is not met" ); diff --git a/contracts/test/unit/EigenDABlobUtils.t.sol b/contracts/test/unit/EigenDABlobUtils.t.sol index f9e8e39f83..27397b21cc 100644 --- a/contracts/test/unit/EigenDABlobUtils.t.sol +++ b/contracts/test/unit/EigenDABlobUtils.t.sol @@ -103,9 +103,9 @@ contract EigenDABlobUtilsUnit is BLSMockAVSDeployer { blobVerificationProof.batchMetadata = batchMetadata; blobVerificationProof.inclusionProof = abi.encodePacked(keccak256(firstBlobHash)); blobVerificationProof.blobIndex = 1; - blobVerificationProof.quorumThresholdIndexes = new bytes(batchHeader.quorumNumbers.length); + blobVerificationProof.quorumIndices = new bytes(batchHeader.quorumNumbers.length); for (uint i = 0; i < batchHeader.quorumNumbers.length; i++) { - blobVerificationProof.quorumThresholdIndexes[i] = bytes1(uint8(i)); + blobVerificationProof.quorumIndices[i] = bytes1(uint8(i)); } uint256 gasBefore = gasleft(); @@ -189,9 +189,9 @@ contract EigenDABlobUtilsUnit is BLSMockAVSDeployer { blobVerificationProof.batchMetadata = batchMetadata; blobVerificationProof.inclusionProof = abi.encodePacked(keccak256(firstBlobHash)); blobVerificationProof.blobIndex = 1; - blobVerificationProof.quorumThresholdIndexes = new bytes(batchHeader.quorumNumbers.length); + blobVerificationProof.quorumIndices = new bytes(batchHeader.quorumNumbers.length); for (uint i = 0; i < batchHeader.quorumNumbers.length; i++) { - blobVerificationProof.quorumThresholdIndexes[i] = bytes1(uint8(i)); + blobVerificationProof.quorumIndices[i] = bytes1(uint8(i)); } uint256 gasBefore = gasleft(); @@ -235,10 +235,10 @@ contract EigenDABlobUtilsUnit is BLSMockAVSDeployer { blobVerificationProof.batchMetadata = batchMetadata; blobVerificationProof.inclusionProof = abi.encodePacked(keccak256(firstBlobHash)); blobVerificationProof.blobIndex = 1; - blobVerificationProof.quorumThresholdIndexes = new bytes(batchHeader.quorumNumbers.length); + blobVerificationProof.quorumIndices = new bytes(batchHeader.quorumNumbers.length); for (uint i = 0; i < batchHeader.quorumNumbers.length; i++) { // implant the incorrect quorumNumbers here - blobVerificationProof.quorumThresholdIndexes[i] = bytes1(uint8(batchHeader.quorumNumbers.length - 1 - i)); + blobVerificationProof.quorumIndices[i] = bytes1(uint8(batchHeader.quorumNumbers.length - 1 - i)); } cheats.expectRevert("EigenDARollupUtils.verifyBlob: quorumNumber does not match"); @@ -280,10 +280,10 @@ contract EigenDABlobUtilsUnit is BLSMockAVSDeployer { blobVerificationProof.batchMetadata = batchMetadata; blobVerificationProof.inclusionProof = abi.encodePacked(keccak256(firstBlobHash)); blobVerificationProof.blobIndex = 1; - blobVerificationProof.quorumThresholdIndexes = new bytes(batchHeader.quorumNumbers.length); + blobVerificationProof.quorumIndices = new bytes(batchHeader.quorumNumbers.length); for (uint i = 0; i < batchHeader.quorumNumbers.length; i++) { // implant the incorrect quorumNumbers here - blobVerificationProof.quorumThresholdIndexes[i] = bytes1(uint8(i)); + blobVerificationProof.quorumIndices[i] = bytes1(uint8(i)); } cheats.expectRevert("EigenDARollupUtils.verifyBlob: confirmationThresholdPercentage is not met"); diff --git a/contracts/test/unit/MockRollup.t.sol b/contracts/test/unit/MockRollup.t.sol index cf493df3df..e0126022ab 100644 --- a/contracts/test/unit/MockRollup.t.sol +++ b/contracts/test/unit/MockRollup.t.sol @@ -146,9 +146,9 @@ contract MockRollupTest is BLSMockAVSDeployer { blobVerificationProof.batchMetadata = batchMetadata; blobVerificationProof.inclusionProof = abi.encodePacked(keccak256(firstBlobHash)); blobVerificationProof.blobIndex = 1; - blobVerificationProof.quorumThresholdIndexes = new bytes(batchHeader.quorumNumbers.length); + blobVerificationProof.quorumIndices = new bytes(batchHeader.quorumNumbers.length); for (uint i = 0; i < batchHeader.quorumNumbers.length; i++) { - blobVerificationProof.quorumThresholdIndexes[i] = bytes1(uint8(i)); + blobVerificationProof.quorumIndices[i] = bytes1(uint8(i)); } return (blobHeader[1], blobVerificationProof);