Skip to content
Request an audit

‹ All findings

Setting maxFundingFeePerBlock to a lower value than abs(lastFundingRate) will brick getPendingAccFundingFees()

MediumOstium·Three Sigma · RWA perpetuals DEX · 19th February, 20243S-OS-M12

Description

getPendingAccFundingFees() computes the number of blocks to the limit by subtracting absLastFundingRate to maxFundingFeePerBlock.

setMaxFundingFeePerBlock() allows setting the max to any value below MAX_FUNDING_FEE.

If maxFundingFeePerBlock is set to a value smaller than absLastFundingRate it will underflow, bricking getPendingAccFundingFees() and it can only be fixed by calling setPairFundingFees().

Here is a POC.

Recommendation

Revert if setMaxFundingFeePerBlock() is called with maxFundingFeePerBlock smaller than absLastFundingRate.

Status

Addressed in #6b6d191, #829ad27.