DatingDapp

First Flight #33
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: high
Invalid

Conflict Between onlyOwners Modifier and Constructor Logic

Summary

onlyOwners modifier and constructor logic contradict each other:

modifier onlyOwners

modifier onlyOwners() {
if (msg.sender != owner1 && msg.sender != owner2) revert NotAnOwner();
_;
}
  • This strictly enforces that msg.sender must be both owner1 and owner2 (due to the && condition).

  • However, this is logically impossible, since msg.sender can only be one address at a time.

    constructor

constructor(address _owner1, address _owner2) {
require(_owner1 != address(0) && _owner2 != address(0), "Invalid owner address");
require(_owner1 != _owner2, "Owners must be different");
owner1 = _owner1;owner2 = _owner2;
}
  • The constructor ensures that owner1 and owner2 are different addresses.

  • This contradicts the onlyOwners modifier, which requires msg.sender to be both at the same time.

Impact

Error: Logical contradiction

  • No transaction can ever pass the onlyOwners check because msg.sender can never be both owner1 and owner2.

  • This makes any function with onlyOwners completely unusable, like submitTransaction, approveTransaction, executeTransactions

Tools Used

Manual

Recommendations

Replace the incorrect && condition with || (OR instead of AND):

modifier onlyOwners() {
if (msg.sender != owner1 || msg.sender != owner2) revert NotAnOwner();
_;
}
Updates

Appeal created

n0kto Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.