The _cancelRequest
function in the Starklane bridge contract, which is responsible for handling the cancellation process, lacks proper error handling for the _withdrawFromEscrow
calls. This oversight can lead to inconsistent escrow states where some tokens may remain locked in escrow despite a cancellation attempt.
The _cancelRequest
function iterates through token IDs and attempts to withdraw each from escrow. However, it does not handle potential errors from the _withdrawFromEscrow
call. If a call fails silently, the function continues to the next token without any indication of the failure.
1: Partial cancellations where some tokens are withdrawn from escrow while others remain locked.
2: Inconsistent escrow state, potentially leading to loss of user funds if tokens cannot be retrieved.
3: Difficulty in detecting which specific tokens failed to be withdrawn during the cancellation process.
4: Potential for subsequent operations to proceed with an incorrect understanding of the escrow state.
Manual review
1: Implement proper error handling for each _withdrawFromEscrow
call:
2: Add a mechanism to track and retry failed withdrawals, ensuring all tokens can eventually be released from escrow.
3: Implement a state machine for cancellation requests to track their progress and final status.
4: Consider implementing a two-phase cancellation process where tokens are first marked for withdrawal and then actually withdrawn in a separate step, allowing for better error recovery.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.