Platform: Code4rena
Start Date: 31/08/2023
Pot Size: $55,000 USDC
Total HM: 5
Participants: 30
Period: 6 days
Judge: hickuphh3
Total Solo HM: 2
Id: 282
League: ETH
Rank: 9/30
Findings: 2
Award: $1,003.03
🌟 Selected for report: 1
🚀 Solo Findings: 0
🌟 Selected for report: ADM
Also found by: HChang26, rvierdiiev, twicek
904.2931 USDC - $904.29
https://github.com/code-423n4/2023-08-livepeer/blob/bcf493b98d0ef835e969e637f25ea51ab77fabb6/contracts/bonding/BondingManager.sol#L273-L277 https://github.com/code-423n4/2023-08-livepeer/blob/bcf493b98d0ef835e969e637f25ea51ab77fabb6/contracts/bonding/BondingManager.sol#L130-L133 https://github.com/code-423n4/2023-08-livepeer/blob/bcf493b98d0ef835e969e637f25ea51ab77fabb6/contracts/bonding/BondingManager.sol#L1667-L1671 https://github.com/code-423n4/2023-08-livepeer/blob/bcf493b98d0ef835e969e637f25ea51ab77fabb6/contracts/bonding/BondingManager.sol#L1500-L1552
BondingVotes may have stale data due to missing checkpoint in BondingManager#withdrawFees().
The withdrawFee function has the autoClaimEarnings modifier:
function withdrawFees(address payable _recipient, uint256 _amount) external whenSystemNotPaused currentRoundInitialized autoClaimEarnings(msg.sender) {
which calls _autoClaimEarnings:
modifier autoClaimEarnings(address _delegator) { _autoClaimEarnings(_delegator); _;
which calls updateDelegatorWithEarnings:
function _autoClaimEarnings(address _delegator) internal { uint256 currentRound = roundsManager().currentRound(); uint256 lastClaimRound = delegators[_delegator].lastClaimRound; if (lastClaimRound < currentRound) { updateDelegatorWithEarnings(_delegator, currentRound, lastClaimRound); } }
During updateDelegatorWithEarnings both delegator.lastClaimRound delegator.bondedAmount can be assigned new values.
del.lastClaimRound = _endRound; // Rewards are bonded by default del.bondedAmount = currentBondedAmount;
However during the lifecycle of all these functions _checkpointBondingState is never called either directly or throught the autoCheckpoint modifier resulting in lastClaimRound & bondedAmount's values being stale in BondingVotes.sol.
Manual Review
Add autoCheckpoint modifier to the withdrawFees function.
Other
#0 - c4-pre-sort
2023-09-07T11:26:33Z
141345 marked the issue as primary issue
#1 - c4-pre-sort
2023-09-09T16:57:59Z
141345 marked the issue as sufficient quality report
#2 - c4-sponsor
2023-09-14T22:53:28Z
victorges (sponsor) confirmed
#3 - c4-judge
2023-09-18T02:16:37Z
HickupHH3 marked the issue as selected for report
#4 - c4-judge
2023-09-18T02:16:46Z
HickupHH3 marked the issue as satisfactory
🌟 Selected for report: catellatech
Also found by: 0x3b, ADM, Banditx0x, JayShreeRAM, Krace, Sathish9098
For this audit I had limited time so focused mainly on three aspects.
(An example of the checklist I created for the variable bondedAmount)
Total time spent on Audit: ~12 Hours
12 hours
#0 - c4-judge
2023-09-22T03:17:06Z
HickupHH3 marked the issue as grade-b