The _ongoingDebtScaledOf
function calculates streaming debt as a simple multiplication of elapsed time and rate per second, without any upper bounds or periodic settlement requirements. This calculation is fundamental to the protocol's accounting system, used in withdrawals, stream status checks, and interoperability with other protocols. The absence of limits allows debt to grow indefinitely as streams run longer or use higher rates.
The issue stems from how debt accumulates without upper limits:
The debt calculation simply multiplies elapsed time by rate, allowing for:
Unlimited time accumulation
No maximum debt ceiling
No periodic settlement requirement
Growing computational costs with larger numbers
For example, a stream running for years with a high rate could accumulate massive debt values, potentially causing issues with gas costs, numerical handling, and protocol integrations.
The unbounded growth in debt calculations creates increasing computational overhead as numbers grow larger, leading to higher gas costs over time. More critically, extremely large debt values can cause integration failures with protocols that have stricter numerical bounds or different decimal handling. When these large values interact with other DeFi protocols' mathematical operations or storage limitations, it could result in transaction failures or incorrect state transitions, effectively breaking interoperability for long-running or high-rate streams.
This fix adds reasonable bounds for stream duration and total debt, plus a settlement mechanism to periodically reset accumulated debt. This prevents unbounded growth while maintaining protocol functionality.
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.