code-423n4 / 2023-04-eigenlayer-findings

1 stars 1 forks source link

Division before multiplication incurs unnecessary precision loss #367

Closed code423n4 closed 1 year ago

code423n4 commented 1 year ago

Lines of code

https://github.com/code-423n4/2023-04-eigenlayer/blob/main/src/contracts/libraries/BeaconChainProofs.sol#L179

Vulnerability details

Impact

Precision loss occurs when division is carried out before multiplication, related with possibility of getting wrong balance of validator. Wrong balance can affect indexing of validator.

Proof of Concept

https://github.com/code-423n4/2023-04-eigenlayer/blob/main/src/contracts/libraries/BeaconChainProofs.sol#L179

Tools Used

Manual Review

Recommended Mitigation Steps

Recommendation is made for avoiding divison before multiplication and always performs division in last to maintain precision.

Assessed type

Math

0xSorryNotSorry commented 1 year ago

AI spam.

c4-pre-sort commented 1 year ago

0xSorryNotSorry marked the issue as low quality report

c4-judge commented 1 year ago

GalloDaSballo marked the issue as unsatisfactory: Invalid