Platform: Code4rena
Start Date: 13/01/2022
Pot Size: $75,000 USDC
Total HM: 9
Participants: 27
Period: 7 days
Judge: leastwood
Total Solo HM: 5
Id: 73
League: ETH
Rank: 10/27
Findings: 2
Award: $1,652.73
🌟 Selected for report: 2
🚀 Solo Findings: 0
🌟 Selected for report: hyh
11.3746 LPT - $421.77
1159.9028 USDC - $1,159.90
hyh
Currently claimStake will fail with low level insufficient funds error if enough balance to cover L1 Delegator fee wasn't transferred to the contract beforehand. It has to be done in a separate call as claimStake isn't payable
claimStake now assumes that there is enough ETH balance in place for the L1 Delegator _fees transfer:
https://github.com/livepeer/arbitrum-lpt-bridge/blob/main/contracts/L2/gateway/L2Migrator.sol#L297
Also, the only payable function of the contract is the default receive():
https://github.com/livepeer/arbitrum-lpt-bridge/blob/main/contracts/L2/gateway/L2Migrator.sol#L235
This way the only operable scenario is to send the fee beforehand and then call claimStake
Consider checking the balance to ensure that the _fees can be actually sent and fail with an explanation otherwise. Also, it looks like claimStake can be made payable and the need for default payable receive() to be examined afterwards
#0 - yondonfu
2022-01-24T02:25:14Z
The points raised are true. But, this is also the expected workflow - ETH is sent to the L2Migrator first and then claimStake()
can be called.
0.3637 LPT - $13.49
37.086 USDC - $37.09
hyh
Gas is overspent on calculations and checks
(initialStake - claimedInitialStake) figure is calculated after require check, so the subtraction itself can be unchecked. Also, it is done twice now, can save the result to memory and use it.
https://github.com/livepeer/arbitrum-lpt-bridge/blob/main/contracts/L2/pool/DelegatorPool.sol#L73
Consider calculating (initialStake - claimedInitialStake) one time and in unchecked scope.
#0 - yondonfu
2022-02-01T17:31:26Z
0.1473 LPT - $5.46
15.0198 USDC - $15.02
hyh
Gas is overspent on the calls
withdrawETHToL1Migrator calls 'address(this).balance' twice:
Use 'balance' variable instead of second call
#0 - yondonfu
2022-01-23T00:53:44Z