DeFiHardhatFoundry
250,000 USDC
View results
Submission Details
Severity: low
Invalid

Duplicate modifier in gm and sunrise and not necessary

Line of code

https://github.com/Cyfrin/2024-05-beanstalk-the-finale/blob/df2dd129a878d16d4adc75049179ac0029d9a96b/protocol/contracts/beanstalk/sun/SeasonFacet/SeasonFacet.sol#L37

Summary

Modifier are incorrectly being used twice

Vulnerability Details

Currently in the sunrise function we are returning by calling gm.
In the sunrise function we have 2 modifier, fundSafu, and noOutFlow these modifiers are also the again applied in the inner call of the function to gm. This means that we are applying the same modifiers twice for no reason.

function sunrise() external payable fundsSafu noOutFlow returns (uint256) {
return gm(LibTractor._user(), LibTransfer.To.EXTERNAL);
}
/**
* @notice Advances Beanstalk to the next Season, sending reward Beans to a specified address & balance.
* @param account Indicates to which address reward Beans should be sent
* @param mode Indicates whether the reward beans are sent to internal or circulating balance
* @return reward The number of Beans minted to the caller.
* @dev No out flow because any externally sent reward beans are freshly minted.
*/
function gm(
address account,
LibTransfer.To mode
) public payable fundsSafu noOutFlow returns (uint256) {

Impact

The current call of sunrise will cost more gas than needed because of the user of the same modifiers twice.

Tools Used

manual review

Recommendations

remove the modifiers in the sunrise function as there are already presnet in gm.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational/Gas

Invalid as per docs https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity

Support

FAQs

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