Skip to content
Request an audit

‹ All findings

RedeemQueue could be optimized

Low/InfoMitosis·Three Sigma · Cross-chain liquidity layer 1 · 25th June, 20243S-Mitosis-N09

Description

The current RedeemQueue implementation goes through requests and marks them as resolved one by one. This is expensive and a much better solution is keeping track of the last index that was resolved, and if the request index is smaller than the last resolved, it means it was resolved (indices are sequential).

Here is the function that settles redeem requests. It gets the correct index to redeem until to by perform binary search, but can also pass it as argument (so the search is performed off chain).

It's also not required to store request.amount as it can be calculated by fetching the last request and subtracting from the current cumulative amount.

Recommendation

It would be much cheaper to redeem batches at once, so a similar method to Lido's could be implemented.

Status

Addressed in #bed727e.