The user will lose their tokens on the secondary chain if they decide to withdraw all their tokens, then for some reason back out and deposit tokens for the same lockId.
The user can send sdl tokens on the secondary chain by queuing the action in SDLPoolSecondary::_queueNewLock, after the system is synchronized with primary chain that token is created with the help of the function SDLPoolSecondary::_mintQueuedNewLocks. Likewise, the user can withdraw their tokens with the help of the function SDLPoolSecondary::withdraw which will enqueue the action and once the system is synchronized with primary chain, the user will get his tokens.
The problem arises when the user deposits tokens again once he has decided to withdraw all their tokens, this will cause them to lose their last deposited tokens. Please see the following test:
User deposits 100 tokens on secondary chain
The system updates the new supply to the primary chain using the handleOutgoingUpdate(). Now user mints the new token lockId=1.
User withdraws all his 100 tokens, the action is queued and the new supply is send to primary chain in order to be synchronized.
User for some reason retracts and deposits 20 tokens to the lockId=1, this action is executed before the Controller returns the response to the secondary chain (step 3). Now the user has two queued actions, the action which the amount is 0 (withdrawal) and the action which the user deposit 20 tokens
Finally the controller updates the new info and the user execute the queued operations for the current batch using the SDLPoolSecondary::_executeQueuedLockUpdates. At this point the withdrawal is executed and the lockId is removed. The user still has the 20 tokens deposit action queued in the getQueuedLockUpdates() function.
System sends the new batch to L1 and then the controller returns the response.
Now the user wants to execute the queued 20 tokens deposit using the SDLPoolSecondary::_executeQueuedLockUpdates and it will be reverted because the lockId was removed in the step 5. User wants to withdraw and also it will be reverted. User lost his tokens.
The user loses tokens.
Manual review
If the user withdraws all his tokens from a lockId, no longer allow a subsequent deposit to the same lockId since those tokens will no longer be recovered.
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.