Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: high
Invalid

Swap Request Tracking Failure

Summary

The initiateSwap function in the StabilityBranch contract fails to increment the totalPendingSwaps counter after processing valid swap requests. This results in incorrect tracking of pending swaps.

Vulnerability Details

/StabilityBranch.sol/initiateSwap

The initiateSwap function does not update the totalPendingSwaps counter after processing valid swap requests. This leads to incorrect tracking of pending swaps, causing the system to lose track of active swap requests. The impact is significant as it disrupts the swap request lifecycle, potentially leading to unfulfilled swaps or incorrect accounting of pending requestsHere is how it Happens.

  1. A user calls initiateSwap with valid parameters: vaultIds = [1], amountsIn = [100], minAmountsOut = [90].

  2. The function processes the request but fails to increment the totalPendingSwaps counter.

  3. The system incorrectly assumes no swap request was created, violating the rule that each valid vault must create one swap request.

  • Pre-Call State:

    • totalPendingSwaps = 0

    • vaultIds = [1], amountsIn = [100], minAmountsOut = [90]

  • Post-Call State:

    • totalPendingSwaps = 0 (expected 1)

Impact

  • Users may not receive their expected assets due to unfulfilled swap requests, leading to direct financial losses.

  • The system incorrectly reports the number of pending swaps, causing mismanagement of swap operations and potential exploitation

Tools Used

vs

Recommendations

Update the initiateSwap function to increment the totalPendingSwaps counter by the number of vault IDs provided

function initiateSwap(...) {
...
totalPendingSwaps += vaultIds.length; // Fix: Increment counter
...
}
Updates

Lead Judging Commences

inallhonesty Lead Judge
4 months ago
inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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