Skip to content

Commit

Permalink
bump middleware to rewardsV2 (Layr-Labs#1008)
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0aa0 authored Dec 16, 2024
1 parent ea8879a commit b679a14
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions contracts/src/core/EigenDAServiceManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ contract EigenDAServiceManager is EigenDAServiceManagerStorage, ServiceManagerBa

/// @notice when applied to a function, ensures that the function is only callable by the `batchConfirmer`.
modifier onlyBatchConfirmer() {
require(isBatchConfirmer[msg.sender], "onlyBatchConfirmer: not from batch confirmer");
require(isBatchConfirmer[msg.sender]);
_;
}

Expand Down Expand Up @@ -80,21 +80,21 @@ contract EigenDAServiceManager is EigenDAServiceManagerStorage, ServiceManagerBa
NonSignerStakesAndSignature memory nonSignerStakesAndSignature
) external onlyWhenNotPaused(PAUSED_CONFIRM_BATCH) onlyBatchConfirmer() {
// make sure the information needed to derive the non-signers and batch is in calldata to avoid emitting events
require(tx.origin == msg.sender, "EigenDAServiceManager.confirmBatch: header and nonsigner data must be in calldata");
require(tx.origin == msg.sender, "header and nonsigner data must be in calldata");
// make sure the stakes against which the Batch is being confirmed are not stale
require(
batchHeader.referenceBlockNumber < block.number, "EigenDAServiceManager.confirmBatch: specified referenceBlockNumber is in future"
batchHeader.referenceBlockNumber < block.number, "specified referenceBlockNumber is in future"
);

require(
(batchHeader.referenceBlockNumber + BLOCK_STALE_MEASURE) >= uint32(block.number),
"EigenDAServiceManager.confirmBatch: specified referenceBlockNumber is too far in past"
"specified referenceBlockNumber is too far in past"
);

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

// calculate reducedBatchHeaderHash which nodes signed
Expand All @@ -118,7 +118,7 @@ contract EigenDAServiceManager is EigenDAServiceManagerStorage, ServiceManagerBa
require(
quorumStakeTotals.signedStakeForQuorum[i] * THRESHOLD_DENOMINATOR >=
quorumStakeTotals.totalStakeForQuorum[i] * uint8(batchHeader.signedStakeForQuorums[i]),
"EigenDAServiceManager.confirmBatch: signatories do not own at least threshold percentage of a quorum"
"signatories do not own threshold percentage of a quorum"
);
}

Expand Down
12 changes: 6 additions & 6 deletions contracts/test/unit/EigenDAServiceManagerUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer {
(BatchHeader memory batchHeader, BLSSignatureChecker.NonSignerStakesAndSignature memory nonSignerStakesAndSignature)
= _getHeaderandNonSigners(0, pseudoRandomNumber, 100);

cheats.expectRevert(bytes("EigenDAServiceManager.confirmBatch: header and nonsigner data must be in calldata"));
cheats.expectRevert(bytes("header and nonsigner data must be in calldata"));
cheats.prank(confirmer, notConfirmer);
eigenDAServiceManager.confirmBatch(
batchHeader,
Expand All @@ -170,7 +170,7 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer {
(BatchHeader memory batchHeader, BLSSignatureChecker.NonSignerStakesAndSignature memory nonSignerStakesAndSignature)
= _getHeaderandNonSigners(0, pseudoRandomNumber, 100);

cheats.expectRevert(bytes("onlyBatchConfirmer: not from batch confirmer"));
cheats.expectRevert();
cheats.prank(notConfirmer, notConfirmer);
eigenDAServiceManager.confirmBatch(
batchHeader,
Expand All @@ -192,7 +192,7 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer {
bytes32 batchHeaderHash = batchHeader.hashBatchHeaderMemory();
nonSignerStakesAndSignature.sigma = BN254.hashToG1(batchHeaderHash).scalar_mul(aggSignerPrivKey);

cheats.expectRevert(bytes("EigenDAServiceManager.confirmBatch: specified referenceBlockNumber is in future"));
cheats.expectRevert(bytes("specified referenceBlockNumber is in future"));
cheats.prank(confirmer, confirmer);
eigenDAServiceManager.confirmBatch(
batchHeader,
Expand All @@ -205,7 +205,7 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer {
= _getHeaderandNonSigners(0, pseudoRandomNumber, 100);

cheats.roll(block.number + eigenDAServiceManager.BLOCK_STALE_MEASURE());
cheats.expectRevert(bytes("EigenDAServiceManager.confirmBatch: specified referenceBlockNumber is too far in past"));
cheats.expectRevert(bytes("specified referenceBlockNumber is too far in past"));
cheats.prank(confirmer, confirmer);
eigenDAServiceManager.confirmBatch(
batchHeader,
Expand All @@ -217,7 +217,7 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer {
(BatchHeader memory batchHeader, BLSSignatureChecker.NonSignerStakesAndSignature memory nonSignerStakesAndSignature)
= _getHeaderandNonSigners(1, pseudoRandomNumber, 100);

cheats.expectRevert(bytes("EigenDAServiceManager.confirmBatch: signatories do not own at least threshold percentage of a quorum"));
cheats.expectRevert(bytes("signatories do not own threshold percentage of a quorum"));
cheats.prank(confirmer, confirmer);
eigenDAServiceManager.confirmBatch(
batchHeader,
Expand Down Expand Up @@ -251,7 +251,7 @@ contract EigenDAServiceManagerUnit is BLSMockAVSDeployer {
= _getHeaderandNonSigners(0, pseudoRandomNumber, 100);
batchHeader.signedStakeForQuorums = new bytes(0);

cheats.expectRevert(bytes("EigenDAServiceManager.confirmBatch: quorumNumbers and signedStakeForQuorums must be of the same length"));
cheats.expectRevert(bytes("quorumNumbers and signedStakeForQuorums must be same length"));
cheats.prank(confirmer, confirmer);
eigenDAServiceManager.confirmBatch(
batchHeader,
Expand Down

0 comments on commit b679a14

Please sign in to comment.