prevent rounding error #124
Labels
1 (Low Risk)
Assets are not at risk. State handling, function incorrect as to spec, issues with comments
bug
Something isn't working
Handle
gpersoon
Vulnerability details
Impact
On several locations in the code a multiplication by 106 and then a division by 106 is used to prevent rounding errors, see examples below.
However in a similar situation in updateStreamInternal(), when calculating ts.tokens, this construction is not used. This might lead to some (probably minor) rounding errors.
Proof of Concept
https://github.com/code-423n4/2021-11-streaming/blob/56d81204a00fc949d29ddd277169690318b36821/Streaming/src/Locke.sol#L203-L250
https://github.com/code-423n4/2021-11-streaming/blob/56d81204a00fc949d29ddd277169690318b36821/Streaming/src/Locke.sol#L355-L363
Tools Used
Recommended Mitigation Steps
Change the code to
The text was updated successfully, but these errors were encountered: