When transferRing RESDL from mainnet to Arbitrum for example, SDL erc20 tokens are not subtracted from controller's effective balance as in the opposite flow - when transferring from Arbitrum to mainnet
The flow is the following.
End user calls transferRESDL on RESDLTokenBridge deployed on Arbitrum for example
The bridge calls SDLCCIPControllerSecondary.handleOutGoingRESDL with _sender being msg.sender
The secondary controller then calls handleOutgoingRESDL on the secondary pool with _sdlReceiver being the secondary controller
The handleOutgoingRESDL on the secondary pool calculates lock.amount + lock.boostAmount and subtracts them from effectiveBalances[_sender] and totalEffectiveBalance.
Then SDL tokens are transferred to the secondary controller
Then the RESDLTokenBridge deployed on mainnet is invoked with ccipReceive from the primary controller
handleIncomingRESDL is called on the primary controller
The primary controller transfers the RESDLToken.amount to the primary pool and subtracts the amount + boost from the Arbitrum sdl supply
handleIncomingRESDL on primary pool then increments effectiveBalances[_receiver] with amount + boost and this same amount gets subtracted from the secondary controller.
Now lets reverse this scenario meaning we are transferring from mainnet to Arbitrum so:
transferRESDL on RESDLTokenBridge deployed on mainnet is called
The bridge calls SDLCCIPControllerPrimary.handleOutGoingRESDL with _sender being msg.sender
The primary controller then calls handleOutgoingRESDL on the primary pool with _sdlReceiver being the primary controller
The handleOutgoingRESDL on the primary pool calculates lock.amount + lock.boostAmount and subtracts them from effectiveBalances[_sender] and adds them to the effectiveBalances[ccipController] (the primary controller)
Then SDL tokens are transferred to the primary controller
Then the RESDLTokenBridge deployed on Arbitrum is invoked with ccipReceive from the secondary controller
handleIncomingRESDL is called on the secondary controller
The secondary controller transfers the RESDLToken.amount to the secondary pool and adds amount + boost to effectiveBalances[_receiver] and to totalEffectiveBalance += totalAmount
But here is the difference, the tokens are not subtracted from the effective balance of the controller, so they exist in the same time in the effective balance of the controller and in the effective balance of the _receiver
This inconsistency could lead to discrepancies in effective balance calculations, affecting reward distributions, staking calculations, or other functionalities dependent on the accurate accounting of effective balances.
Manual Review
In the scenario where RESDL lock is transferred from mainnet to a secondary chain, when the secondary controller transfers the lock.amount to the secondary pool subtract the amount + boost from the effective balance of the controller.
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.