Skip to content

Commit

Permalink
feat(contracts): add virtual modifiers for poll
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmad committed Sep 16, 2024
1 parent 4deae8b commit a13f735
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/contracts/contracts/Poll.sol
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ contract Poll is Params, Utilities, SnarkCommon, IPoll {
/// @dev Can only be submitted before the voting deadline
/// @param _messages the messages
/// @param _encPubKeys the encrypted public keys
function publishMessageBatch(Message[] calldata _messages, PubKey[] calldata _encPubKeys) external {
function publishMessageBatch(
Message[] calldata _messages,

Check warning

Code scanning / Slither

Conformance to Solidity naming conventions Warning

PubKey[] calldata _encPubKeys

Check warning

Code scanning / Slither

Conformance to Solidity naming conventions Warning

) public virtual isWithinVotingDeadline {
if (_messages.length != _encPubKeys.length) {
revert InvalidBatchLength();
}
Expand All @@ -199,7 +202,7 @@ contract Poll is Params, Utilities, SnarkCommon, IPoll {
}

/// @inheritdoc IPoll
function mergeMaciState() public isAfterVotingDeadline {
function mergeMaciState() public virtual isAfterVotingDeadline {
// This function can only be called once per Poll after the voting
// deadline
if (stateMerged) revert StateAlreadyMerged();
Expand Down Expand Up @@ -234,13 +237,13 @@ contract Poll is Params, Utilities, SnarkCommon, IPoll {
}

/// @inheritdoc IPoll
function mergeMessageAqSubRoots(uint256 _numSrQueueOps) public isAfterVotingDeadline {
function mergeMessageAqSubRoots(uint256 _numSrQueueOps) public virtual isAfterVotingDeadline {

Check warning

Code scanning / Slither

Conformance to Solidity naming conventions Warning

extContracts.messageAq.mergeSubRoots(_numSrQueueOps);
emit MergeMessageAqSubRoots(_numSrQueueOps);
}

Check notice

Code scanning / Slither

Reentrancy vulnerabilities Low


/// @inheritdoc IPoll
function mergeMessageAq() public isAfterVotingDeadline {
function mergeMessageAq() public virtual isAfterVotingDeadline {
uint256 root = extContracts.messageAq.merge(treeDepths.messageTreeDepth);
emit MergeMessageAq(root);
}

Check notice

Code scanning / Slither

Reentrancy vulnerabilities Low

Reentrancy in Poll.mergeMessageAq():
External calls:
- root = extContracts.messageAq.merge(treeDepths.messageTreeDepth)
Event emitted after the call(s):
- MergeMessageAq(root)
Expand Down

0 comments on commit a13f735

Please sign in to comment.