Weekly VIP 2026 - Week 54 | Risk Fund Sweep Function Fix Proposal

1. Context

An edge case in the Risk Fund V2 contract related to the token sweeping mechanism was identified. Specifically, when the contract holds tokens that are not associated with any pool, the preSweepToken function may calculate pool-level token shares incorrectly.

This can cause the sweep operation to revert, creating a denial-of-service scenario for governance-initiated token sweeps. While no user funds are directly at risk, this issue affects the reliability of protocol maintenance actions.

2. Action Required

A targeted fix is proposed to update the per-pool calculation logic so that it uses the actual amount required from pooled funds rather than the total requested sweep amount. This adjustment prevents arithmetic underflow when untracked tokens are present.

The change is limited to a single line in the RiskFundV2.sol contract and does not modify external interfaces or user-facing behavior. If approved, this update would be executed via a VIP.

3. Summary

  • An edge case in the Risk Fund sweep logic can cause governance sweep actions to revert
  • The issue arises when untracked tokens exist in the contract balance
  • The fix improves robustness without impacting users or fund safety
  • Execution is subject to approval through a VIP

We welcome community feedback on this proposal ahead of formal governance submission.

2 Likes

I generally view the proposed fix positively.

As an additional note, it could be helpful to include extra test coverage (unit or invariant tests) for scenarios involving untracked tokens, to help prevent similar edge cases in the future.

Other than that, the scope of the change and its risk profile seem well suited for the VIP process.

———————————————————

Önerilen düzeltmeyi genel olarak olumlu buluyorum.

Ek olarak, ileride benzer durumların önüne geçmek adına untracked token senaryolarını kapsayan ek testlerin (unit / invariant tests) eklenmesi faydalı olabilir.

Bunun dışında, değişikliğin kapsamı ve risk profili VIP süreci için oldukça uygun.