Omniscia vfat Audit

PositionSettingsRegistry Manual Review Findings

PositionSettingsRegistry Manual Review Findings

PSR-01M: Improper Validation of Slippage Value

Description:

The referenced slippage value defined in basis points is insufficiently validated as it is permitted to be 0.

Impact:

A slippage value of 0 is effectively invalid as the likelihood of the associated operation reverting is significantly high.

Example:

contracts/PositionSettingsRegistry.sol
195if (settings.autoExit) {
196 if (
197 settings.exitConfig.triggerPriceLow == 0
198 && settings.exitConfig.triggerPriceHigh == 0
199 ) {
200 revert ExitTriggersNotSet();
201 }
202 if (
203 settings.exitConfig.triggerPriceLow
204 >= settings.exitConfig.triggerPriceHigh
205 ) {
206 revert InvalidExitTriggers();
207 }
208 if (settings.exitConfig.slippageBP > MAX_SLIPPAGE_BP) {
209 revert InvalidSlippageBP();
210 }
211 if (
212 settings.exitConfig.priceImpactBP > MAX_PRICE_IMPACT_BP
213 || settings.exitConfig.priceImpactBP == 0
214 ) {
215 revert InvalidPriceImpactBP();
216 }
217} else {
218 if (
219 settings.exitConfig.triggerPriceLow != 0
220 || settings.exitConfig.triggerPriceHigh != 0
221 || settings.exitConfig.exitTokenOutLow != address(0)
222 || settings.exitConfig.exitTokenOutHigh != address(0)
223 || settings.exitConfig.slippageBP != 0
224 || settings.exitConfig.priceImpactBP != 0
225 ) {
226 revert NonZeroExitConfig();
227 }
228}

Recommendation:

Similarly to other configurational variables, we advise it to be sanitized as being non-zero so as to ensure a valid slippage configuration value.

Alleviation (6ab7af3bb495b817ffec469255ea679b1813eecb):

The vfat team evaluated this exhibit and stated that a zero-value slippage is desirable.

While the code will behave as expected when the zero-value slippage is imposed, the dynamic conditions of the market will significantly increase the likelihood of such a transaction reverting and would usually indicate malformed input.

In any case, as the vfat team wishes to retain this behaviour as acceptable within their codebase we consider this exhibit to be acknowledged.