sherlock-audit / 2023-02-carapace-judging

2 stars 0 forks source link

joestakey - `DefaultStateManager.assessStates()` can be DOS if there is enough protection pools #315

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

joestakey

medium

DefaultStateManager.assessStates() can be DOS if there is enough protection pools

Summary

If too many protection pools are created, DefaultStateManager.assessStates() will revert.

Vulnerability Detail

When a protection pool is created, it is pushed to protectionPoolStates. assessStates() which is a function called daily by the protocol, loops through the entire protectionPoolStates array. If it is large enough, the call will revert with an out-of-gas error.

Impact

assessStates reverting means it is impossible to update the states of the pools, preventing unlocking pools that need to be (or vice-versa)

Code Snippet

https://github.com/sherlock-audit/2023-02-carapace/blob/main/contracts/core/DefaultStateManager.sol#L126

Tool used

Manual Review

Recommendation

Add a check in registerProtectionPool() to ensure protectionPoolStates never exceeds a pre-defined upper limit.