Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit-tests for Math #775

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

claudijd
Copy link
Contributor

@claudijd claudijd commented Jun 17, 2023

This PR adds forge unit-tests for the Math.sol implementation and additionally adds comments

@claudijd claudijd changed the title Add math tests Add unit-tests for Math.sol Jun 17, 2023
@claudijd claudijd changed the title Add unit-tests for Math.sol Add unit-tests for Math Jun 17, 2023
@claudijd claudijd changed the base branch from master to develop June 17, 2023 23:08
@TheDZhon TheDZhon requested review from loga4 and TheDZhon June 19, 2023 20:29
@@ -15,6 +15,8 @@ library Math {

/// @notice Tests if x ∈ [a, b) (mod n)
///
/// It is known that this function is susceptable to underflow/overflow/division-by-zero if
/// intending to use in an unchecked context, be considerate of these possibilities
function pointInHalfOpenIntervalModN(uint256 x, uint256 a, uint256 b, uint256 n)
Copy link
Contributor

@loga4 loga4 Jun 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lido does not use these functions, and since they contain potential problems, I suggest removing them from the library at all (and tests too).

Copy link
Contributor

@TheDZhon TheDZhon Jun 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an interesting proposal 🤔

The bytecode of the contracts will remain the same (because the compiler doesn't emit a bytecode for the unused library functions unless referenced somehow in the code). However, we would need to re-verify the sources on Etherscan.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed both the implementation and the associated tests for the unused function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants