Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: high
Invalid

Incorrect logic used to get the RapperSkills in ```RapBattle::getRapperSkills```

Summary

The protocol uses the incorrect logic compared to the one that is specified in the docs, the docs mentioned the value be added rather it is subtracted

Vulnerability Details

We can see here that the code didnt follow the docs and rather used to subtract

```javascript function getRapperSkill(uint256 _tokenId) public view returns (uint256 finalSkill) { IOneShot.RapperStats memory stats = oneShotNft.getRapperStats(_tokenId); finalSkill = BASE_SKILL; if (stats.weakKnees) { finalSkill -= VICE_DECREMENT; } if (stats.heavyArms) { finalSkill -= VICE_DECREMENT; } if (stats.spaghettiSweater) { finalSkill -= VICE_DECREMENT; } if (stats.calmAndReady) { finalSkill += VIRTUE_INCREMENT; } } ```

Impact

This gives the wrong skill value of the rapper which when divided by the random number will result in an incorrect value which is used to pick an incorrect winner

Tools Used

Manual Review

Recommendations

function getRapperSkill(uint256 _tokenId) public view returns (uint256 finalSkill) {
IOneShot.RapperStats memory stats = oneShotNft.getRapperStats(_tokenId);
finalSkill = BASE_SKILL;
- if (stats.weakKnees) {
- finalSkill -= VICE_DECREMENT;
+ if (!stats.weakKnees) {
+ finalSkill += VICE_DECREMENT;
}
- if (stats.heavyArms) {
- finalSkill -= VICE_DECREMENT;
+ if (!stats.heavyArms) {
+ finalSkill += VICE_DECREMENT;
}
- if (stats.spaghettiSweater) {
- finalSkill -= VICE_DECREMENT;
+ if (!stats.spaghettiSweater) {
+ finalSkill += VICE_DECREMENT;
}
}
if (stats.calmAndReady) {
finalSkill += VIRTUE_INCREMENT;
}
}
Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Oxmetapunk Submitter
over 1 year ago
inallhonesty Lead Judge
over 1 year ago
inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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