Skip to content

Commit

Permalink
fix: add more check on quorum parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
renlulu authored Apr 4, 2024
1 parent f6d7441 commit 63fc6ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion contracts/src/core/MachServiceManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import {
InsufficientThreshold,
InvalidStartIndex,
InsufficientThresholdPercentages,
InvalidSender
InvalidSender,
InvalidQuorumParam
} from "../error/Errors.sol";
import {IMachServiceManager} from "../interfaces/IMachServiceManager.sol";

Expand Down Expand Up @@ -203,12 +204,18 @@ contract MachServiceManager is
if (tx.origin != msg.sender) {
revert InvalidSender();
}

// make sure the stakes against which the Batch is being confirmed are not stale
if (alertHeader.referenceBlockNumber > block.number) {
revert InvalidReferenceBlockNum();
}
bytes32 hashedHeader = hashAlertHeader(alertHeader);

// check quorum parameters
if (alertHeader.quorumNumbers.length != alertHeader.quorumThresholdPercentages.length) {
revert InvalidQuorumParam();
}

// check the signature
(QuorumStakeTotals memory quorumStakeTotals, bytes32 signatoryRecordHash) = checkSignatures(
hashedHeader,
Expand Down
1 change: 1 addition & 0 deletions contracts/src/error/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ error InvalidSender();
error InvalidReferenceBlockNum();
error InsufficientThreshold();
error InsufficientThresholdPercentages();
error InvalidQuorumParam();
error AlreadyInAllowlist();
error NotInAllowlist();

Expand Down

0 comments on commit 63fc6ab

Please sign in to comment.