Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: low
Valid

Incorrect Array Length Parameters in Error Message for Deposit and Redeem Fees Validation

Summary

In the configureDepositAndRedeemFees function, when comparing depositFees.length with redeemFees.length, the error message incorrectly uses vaultsIds.length and depositFees.length as parameters instead of the actual arrays being compared.

Vulnerability Details

Looking at the configureDepositAndRedeemFees function:

function configureDepositAndRedeemFees(
uint128[] calldata vaultsIds,
uint128[] calldata depositFees,
uint128[] calldata redeemFees
)
external
onlyOwner
{
// verify the array length
if (vaultsIds.length != depositFees.length) {
revert Errors.ArrayLengthMismatch(vaultsIds.length, depositFees.length);
}
// verify the array length
if (depositFees.length != redeemFees.length) {
revert Errors.ArrayLengthMismatch(vaultsIds.length, depositFees.length); // @audit incorrect parameters
}
// ...
}

The second length check compares depositFees.length with redeemFees.length, but the error message uses vaultsIds.length and depositFees.length as parameters, which don't correspond to the arrays being compared.

Impact

It impacts the debugging experience as the error message will show incorrect array lengths when there's a mismatch between depositFees and redeemFees arrays, making it harder to identify and fix array length issues.

Tools Used

Manual code review

Recommendations

Update the error message parameters to match the arrays being compared:

function configureDepositAndRedeemFees(
uint128[] calldata vaultsIds,
uint128[] calldata depositFees,
uint128[] calldata redeemFees
)
external
onlyOwner
{
// verify the array length
if (vaultsIds.length != depositFees.length) {
revert Errors.ArrayLengthMismatch(vaultsIds.length, depositFees.length);
}
// verify the array length
if (depositFees.length != redeemFees.length) {
revert Errors.ArrayLengthMismatch(depositFees.length, redeemFees.length); // Fixed parameters
}
// ...
}

This will ensure that the error message accurately reflects the arrays being compared, making debugging easier.

Updates

Lead Judging Commences

inallhonesty Lead Judge 6 months ago
Submission Judgement Published
Validated
Assigned finding tags:

configureDepositAndRedeemFees function emits the wrong parameters inside the `(depositFees.length != redeemFees.length)` check

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.