The Sun contract ignores the current debt level (pre-calculated Weather case) when the season is below peg (pre-calculated deltaB is equal or less than zero). The Sun.setSoilBelowPeg function always chooses the minimal value from instDeltaB and twaDeltaB. This approach is good only for "Reasonably High" and "Excessively High" debt levels. But in case of "Excessively Low" debt level the maximal from instDeltaB and twaDeltaB can be more appropriate.
The Sun.stepSun function uses caseId when season is above peg:
This lets to keep the debt at the optimal level by moving the debt to the ideal equilibrium (https://docs.bean.money/almanac/peg-maintenance/temperature#direction).
But in case the season is below peg the debt level is ignored and the minimum from instDeltaB and twaDeltaB amount is set as new soil.
When the debt level is low, choosing the minimal value can slow down the optimal debt reaching.
Unexpected behavior, debt is increased on a lower amount than the closest to ideal.
Manual Review
Consider taking into account the pre-calculated Weather case to choose the most appropriate value from instDeltaB and twaDeltaB.
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.