Skip to content

Commit

Permalink
signedStakeForQuorums name change
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0aa0 committed Mar 6, 2024
1 parent de26613 commit a45d573
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions contracts/src/core/EigenDAServiceManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ contract EigenDAServiceManager is EigenDAServiceManagerStorage, ServiceManagerBa
"EigenDAServiceManager.confirmBatch: specified referenceBlockNumber is too far in past"
);

//make sure that the quorumNumbers and confirmationThresholdPercentages are of the same length
//make sure that the quorumNumbers and signedStakeForQuorums are of the same length
require(
batchHeader.quorumNumbers.length == batchHeader.confirmationThresholdPercentages.length,
"EigenDAServiceManager.confirmBatch: quorumNumbers and confirmationThresholdPercentages must be of the same length"
batchHeader.quorumNumbers.length == batchHeader.signedStakeForQuorums.length,
"EigenDAServiceManager.confirmBatch: quorumNumbers and signedStakeForQuorums must be of the same length"
);

// calculate reducedBatchHeaderHash which nodes signed
Expand All @@ -101,12 +101,12 @@ contract EigenDAServiceManager is EigenDAServiceManagerStorage, ServiceManagerBa
);

// check that signatories own at least a threshold percentage of each quourm
for (uint i = 0; i < batchHeader.confirmationThresholdPercentages.length; i++) {
// we don't check that the confirmationThresholdPercentages are not >100 because a greater value would trivially fail the check, implying
for (uint i = 0; i < batchHeader.signedStakeForQuorums.length; i++) {
// we don't check that the signedStakeForQuorums are not >100 because a greater value would trivially fail the check, implying
// signed stake > total stake
require(
quorumStakeTotals.signedStakeForQuorum[i] * THRESHOLD_DENOMINATOR >=
quorumStakeTotals.totalStakeForQuorum[i] * uint8(batchHeader.confirmationThresholdPercentages[i]),
quorumStakeTotals.totalStakeForQuorum[i] * uint8(batchHeader.signedStakeForQuorums[i]),
"EigenDAServiceManager.confirmBatch: signatories do not own at least threshold percentage of a quorum"
);
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/interfaces/IEigenDAServiceManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ interface IEigenDAServiceManager is IServiceManager {
struct BatchHeader {
bytes32 blobHeadersRoot;
bytes quorumNumbers; // each byte is a different quorum number
bytes confirmationThresholdPercentages; // every bytes is an amount less than 100 specifying the percentage of stake
bytes signedStakeForQuorums; // every bytes is an amount less than 100 specifying the percentage of stake
// the must have signed in the corresponding quorum in `quorumNumbers`
uint32 referenceBlockNumber;
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/libraries/EigenDARollupUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ library EigenDARollupUtils {
}

// make sure that the stake signed for is greater than the given confirmationThresholdPercentage
require(uint8(blobVerificationProof.batchMetadata.batchHeader.confirmationThresholdPercentages[uint8(blobVerificationProof.quorumThresholdIndexes[i])])
require(uint8(blobVerificationProof.batchMetadata.batchHeader.signedStakeForQuorums[uint8(blobVerificationProof.quorumThresholdIndexes[i])])
>= blobHeader.quorumBlobParams[i].confirmationThresholdPercentage,
"EigenDARollupUtils.verifyBlob: confirmationThresholdPercentage is not met"
);
Expand Down
8 changes: 4 additions & 4 deletions contracts/test/unit/EigenDABlobUtils.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ contract EigenDABlobUtilsUnit is BLSMockAVSDeployer {
// add dummy quorum numbers and quorum threshold percentages making sure confirmationThresholdPercentage = adversaryThresholdPercentage + defaultCodingRatioPercentage
for (uint i = 0; i < blobHeader[1].quorumBlobParams.length; i++) {
batchHeader.quorumNumbers = abi.encodePacked(batchHeader.quorumNumbers, blobHeader[1].quorumBlobParams[i].quorumNumber);
batchHeader.confirmationThresholdPercentages = abi.encodePacked(batchHeader.confirmationThresholdPercentages, blobHeader[1].quorumBlobParams[i].adversaryThresholdPercentage + defaultCodingRatioPercentage);
batchHeader.signedStakeForQuorums = abi.encodePacked(batchHeader.signedStakeForQuorums, blobHeader[1].quorumBlobParams[i].adversaryThresholdPercentage + defaultCodingRatioPercentage);
}
batchHeader.referenceBlockNumber = uint32(block.number);

Expand Down Expand Up @@ -168,7 +168,7 @@ contract EigenDABlobUtilsUnit is BLSMockAVSDeployer {
// add dummy quorum numbers and quorum threshold percentages making sure confirmationThresholdPercentage = adversaryThresholdPercentage + defaultCodingRatioPercentage
for (uint i = 0; i < blobHeader[1].quorumBlobParams.length; i++) {
batchHeader.quorumNumbers = abi.encodePacked(batchHeader.quorumNumbers, blobHeader[1].quorumBlobParams[i].quorumNumber);
batchHeader.confirmationThresholdPercentages = abi.encodePacked(batchHeader.confirmationThresholdPercentages, blobHeader[1].quorumBlobParams[i].adversaryThresholdPercentage + defaultCodingRatioPercentage);
batchHeader.signedStakeForQuorums = abi.encodePacked(batchHeader.signedStakeForQuorums, blobHeader[1].quorumBlobParams[i].adversaryThresholdPercentage + defaultCodingRatioPercentage);
}
batchHeader.referenceBlockNumber = uint32(block.number);

Expand Down Expand Up @@ -214,7 +214,7 @@ contract EigenDABlobUtilsUnit is BLSMockAVSDeployer {
// add dummy quorum numbers and quorum threshold percentages making sure confirmationThresholdPercentage = adversaryThresholdPercentage + defaultCodingRatioPercentage
for (uint i = 0; i < blobHeader[1].quorumBlobParams.length; i++) {
batchHeader.quorumNumbers = abi.encodePacked(batchHeader.quorumNumbers, blobHeader[1].quorumBlobParams[i].quorumNumber);
batchHeader.confirmationThresholdPercentages = abi.encodePacked(batchHeader.confirmationThresholdPercentages, blobHeader[1].quorumBlobParams[i].adversaryThresholdPercentage + defaultCodingRatioPercentage);
batchHeader.signedStakeForQuorums = abi.encodePacked(batchHeader.signedStakeForQuorums, blobHeader[1].quorumBlobParams[i].adversaryThresholdPercentage + defaultCodingRatioPercentage);
}
batchHeader.referenceBlockNumber = uint32(block.number);

Expand Down Expand Up @@ -259,7 +259,7 @@ contract EigenDABlobUtilsUnit is BLSMockAVSDeployer {
// add dummy quorum numbers and quorum threshold percentages making sure confirmationThresholdPercentage = 100
for (uint i = 0; i < blobHeader[1].quorumBlobParams.length; i++) {
batchHeader.quorumNumbers = abi.encodePacked(batchHeader.quorumNumbers, blobHeader[1].quorumBlobParams[i].quorumNumber);
batchHeader.confirmationThresholdPercentages = abi.encodePacked(batchHeader.confirmationThresholdPercentages, blobHeader[1].quorumBlobParams[i].confirmationThresholdPercentage - 1);
batchHeader.signedStakeForQuorums = abi.encodePacked(batchHeader.signedStakeForQuorums, blobHeader[1].quorumBlobParams[i].confirmationThresholdPercentage - 1);
}
batchHeader.referenceBlockNumber = uint32(block.number);

Expand Down
8 changes: 4 additions & 4 deletions contracts/test/unit/EigenDAServiceManagerUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer {
function testConfirmBatch_Revert_LengthMismatch(uint256 pseudoRandomNumber) public {
(IEigenDAServiceManager.BatchHeader memory batchHeader, BLSSignatureChecker.NonSignerStakesAndSignature memory nonSignerStakesAndSignature)
= _getHeaderandNonSigners(0, pseudoRandomNumber, 100);
batchHeader.confirmationThresholdPercentages = new bytes(0);
batchHeader.signedStakeForQuorums = new bytes(0);

cheats.expectRevert(bytes("EigenDAServiceManager.confirmBatch: quorumNumbers and confirmationThresholdPercentages must be of the same length"));
cheats.expectRevert(bytes("EigenDAServiceManager.confirmBatch: quorumNumbers and signedStakeForQuorums must be of the same length"));
cheats.prank(confirmer, confirmer);
eigenDAServiceManager.confirmBatch(
batchHeader,
Expand Down Expand Up @@ -204,9 +204,9 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer {
IEigenDAServiceManager.BatchHeader memory batchHeader;
batchHeader.blobHeadersRoot = keccak256(abi.encodePacked("blobHeadersRoot", pseudoRandomNumber));
batchHeader.quorumNumbers = quorumNumbers;
batchHeader.confirmationThresholdPercentages = new bytes(quorumNumbers.length);
batchHeader.signedStakeForQuorums = new bytes(quorumNumbers.length);
for (uint256 i = 0; i < quorumNumbers.length; i++) {
batchHeader.confirmationThresholdPercentages[i] = bytes1(threshold);
batchHeader.signedStakeForQuorums[i] = bytes1(threshold);
}
batchHeader.referenceBlockNumber = referenceBlockNumber;
return batchHeader;
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/unit/MockRollup.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ contract MockRollupTest is BLSMockAVSDeployer {
// add dummy quorum numbers and quorum threshold percentages making sure confirmationThresholdPercentage = adversaryThresholdPercentage + defaultCodingRatioPercentage
for (uint i = 0; i < blobHeader[1].quorumBlobParams.length; i++) {
batchHeader.quorumNumbers = abi.encodePacked(batchHeader.quorumNumbers, blobHeader[1].quorumBlobParams[i].quorumNumber);
batchHeader.confirmationThresholdPercentages = abi.encodePacked(batchHeader.confirmationThresholdPercentages, blobHeader[1].quorumBlobParams[i].adversaryThresholdPercentage + defaultCodingRatioPercentage);
batchHeader.signedStakeForQuorums = abi.encodePacked(batchHeader.signedStakeForQuorums, blobHeader[1].quorumBlobParams[i].adversaryThresholdPercentage + defaultCodingRatioPercentage);
}
batchHeader.referenceBlockNumber = uint32(block.number);

Expand Down

0 comments on commit a45d573

Please sign in to comment.