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

Adding more waitlisted tokens can make calling the `gm` function unprofitable, which will delay the start of a new season

Summary

The gm function is called to start a new season and pays the caller in bean tokens to cover the gas cost of calling the function. The function has a maximum pay so it is not going above that amount no matter how much it costs to call the gm function.

Vulnerability Details

The vulnerability arises from looping through the getWhitelistedWellLpTokens array, in the stepOracle, LibGerminate.endTotalGermination, LibGauge.stepGauge, and incentivize functions, this array grows as new whitelisted tokens are added.

function gm(
address account,
LibTransfer.To mode
) public payable fundsSafu noOutFlow returns (uint256) {
require(!s.sys.paused, "Season: Paused.");
require(seasonTime() > s.sys.season.current, "Season: Still current Season.");
uint32 season = stepSeason();
@-> int256 deltaB = stepOracle();
uint256 caseId = calcCaseIdandUpdate(deltaB);
LibGerminate.endTotalGermination(season, LibWhitelistedTokens.getWhitelistedTokens());
LibGauge.stepGauge();
stepSun(deltaB, caseId);
@-> return incentivize(account, mode);
}

As the number of whitelist tokens increases calling the gm function will get more expensive.

Impact

Delay in starting a new season, because the reward in bean is less than the gas cost.

Tools Used

Manual Analysis

Recommendations

Put a cap on the amount of white list tokens allowed at a given time.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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