DatingDapp

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

Missing Liked Users Array in LikeRegistry

Description

The LikeRegistry contract lacks an array to track all users that each user has liked, making it difficult for the frontend to display liked profiles and prevent duplicate likes. This leads to poor UX and potential wasted gas on failed transactions.

Current implementation only tracks likes in a boolean mapping:

mapping(address => mapping(address => bool)) public likes;

Missing critical tracking:

// Should have this array
mapping(address => address[]) public likedUsers;

Impact:

  • Poor user experience

  • Wasted gas on failed transactions

  • Frontend cannot show liked profiles

  • Users cannot track their likes

  • Difficult to build user dashboard

Fix Recommendation:

  • Add liked users array:

add code snippet to likeUser function.

mapping(address => address[]) public likedUsers;
function likeUser(address liked) external payable {
//other code
// Add to liked users array
likedUsers[msg.sender].push(liked);
//other code
}
  • Add getter functions:

function getLikedUsers(address user) external view returns (address[] memory){
return likedUsers[user];
}

Tools Used

  • Foundry Testing Framework

  • Manual Review

Updates

Appeal created

n0kto Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Design choice
Assigned finding tags:

Informational or Gas

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.

Support

FAQs

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