code-423n4 / 2022-01-livepeer-findings

0 stars 0 forks source link

Repeated math operations #222

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

pauliax

Vulnerability details

Impact

(initialStake - claimedInitialStake) is re-calculated twice:

  // Calculate stake owed to delegator
  uint256 currTotalStake = pendingStake();
  uint256 owedStake = (currTotalStake * _stake) /
      (initialStake - claimedInitialStake);

  // Calculate fees owed to delegator
  uint256 currTotalFees = pendingFees();
  uint256 owedFees = (currTotalFees * _stake) /
      (initialStake - claimedInitialStake);
yondonfu commented 2 years ago

Duplicate of https://github.com/code-423n4/2022-01-livepeer-findings/issues/154