Adapters could store the index instead of true in the VaultV2 to remove the O(n) search
Summary
VaultV2::setIsAdapter() removes the adapter from the array by doing a O(n) search, which is ineffective.
Vulnerability Detail
The number of adapters is admin controlled so DoS should never happen due to OOG. However, it could not even be a concern in case the index of the adapter plus one (1) was stored in the mapping, such that no search was needed.
Impact
Gas optimization and better security guarantees.
Code Snippet
Tool Used
Manual Review
Recommendation
Store the index plus one (1) in the mapping instead and use it to remove from the array.