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

H-1 Discrepancy between getRapperSkill Implementation and Documentation

Summary

The implementation of the getRapperSkill function in RapBattle.sol (line 86) significantly deviates from the description provided in the documentation.

Vulnerability Details

The documentation states:

Users can put their Cred on the line to step on stage and battle their Rappers. A base skill of 50 is applied to all rappers in battle, and this is modified by the properties the rapper holds.
- WeakKnees - False = +5
- HeavyArms - False = +5
- SpaghettiSweater - False = +5
- CalmAndReady - True = +10

However, the actual code is as follows:

if (stats.weakKnees) {
finalSkill -= VICE_DECREMENT;
}
if (stats.heavyArms) {
finalSkill -= VICE_DECREMENT;
}
if (stats.spaghettiSweater) {
finalSkill -= VICE_DECREMENT;
}
if (stats.calmAndReady) {
finalSkill += VIRTUE_INCREMENT;
}

This implementation is inconsistent with the documentation.

Impact

The discrepancy between the implementation and the documentation of the getRapperSkill function will affect the game rules and the accuracy of the documentation. This could lead to confusion among users regarding how skills are calculated and potentially impact the fairness of battles in the game.

Tools Used

Manual review

Recommendations

To align the code with the documentation, the following changes are recommended:

- uint256 public constant VICE_DECREMENT = 5;
+ uint256 public constant VICE_INCREMENT = 5;
- if (stats.weakKnees) {
- finalSkill -= VICE_DECREMENT;
+ if (!stats.weakKnees) {
+ finalSkill += VICE_INCREMENT;
}
- if (stats.heavyArms) {
- finalSkill -= VICE_DECREMENT;
+ if (!stats.heavyArms) {
+ finalSkill += VICE_INCREMENT;
}
- if (stats.spaghettiSweater) {
- finalSkill -= VICE_DECREMENT;
+ if (!stats.spaghettiSweater) {
+ finalSkill += VICE_INCREMENT;
}
Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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