The LibEvaluate
calculates the caseId
based on the state of Beanstalk.
This library has the following functions
calcDeltaPodDemand
- Calculates the change in soil demand from the previous season.
evalDeltaPodDemand
- updates the caseId based on the change in Soil demand.
The issue is that calcDeltaPodDemand generates an incorrect value whenever there is a change in soil demand by considering a scenario where no beans were sown in the last season as a "high increasing change for pod demand."
lastSowTime == type(uint32).max
Indicates no soil was sown last season, but if this condition is met, the value returned by this function is Decimal.from(1e18)
which results in 1e36
. This is higher than the deltaPodDemandUpperBound
which is 1.05e18, therefore evalPodDemand will consider that Beanstalk has an increasing podRate:
If Beanstalk didn't sow beans last season but has sown beans this season, it means that Beanstalk has recently (this season) entered a state that requires issuing soil.
When this happens, Beanstalk should be able to issue debt and burn beans, a.k.a allow sowing. But as we can see above, we are increasing the value of the caseId
which will impact how much soil will be issued.
A higher caseId
will increase the chances of reaching the high pod rate threshold and limit the issuance of soil.
When in fact, the scenario described should be treated as a "steady" increase, not a high increase. This is because Beanstalk still needs to issue debt to maintain the peg in a steady manner.
Due to the current logic, Beanstalk will issue less soil than necessary, making it harder to maintain the peg.
The caseId will be incorrect, compromising the Beanstalk peg by not issuing enough soil when needed, causing it to remain under the peg.
This will cause a cascade effect in the system as temperature, the gauge system, soil issuance, and the generalized flood all rely on the caseId.
Manual Review
Handle the following case as a steady change on the soil demand:
Check if Soil Sold Out This Season (thisSowTime < type(uint32).max):
- Condition 1: lastSowTime == type(uint32).max - Indicates no soil was sown last season.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.