-
Notifications
You must be signed in to change notification settings - Fork 9
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
Dawn Blossoms Plucked at Dusk #38
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The existing assembly code calculating the 'ratio' variable in TickMath.sol has been refactored for simplicity and efficiency. This result is achieved by removing an unnecessary mask operation and replacing it with a more straightforward expression that improves code readability and reduces complexity.
The `amountRemainingAbs` variable in SwapMath.sol was removed to simplify code logic. The conversion to an unsigned integer is now performed directly where required, which eliminates the need for the intermediate variable. This change improves code readability and maintainability.
…Bitmap In this commit, new test cases are added for TickMath.t.sol to examine the 'Revert_GetSqrtRatioAtTick' and 'Revert_GetTickAtSqrtRatio' methods; and also added new functions to test bitmap manipulations in TickBitmap.t.sol such as 'flipTick' and 'isInitialized'. Additionally, existing test cases are modified to improve coverage and enhance test robustness.
The calculation method for the bit mask in the TickBitmap module has been changed. The new calculation approach "(2 << bitPos) - 1" replaces the previous "(1 << (bitPos + 1)) - 1" resulting in better efficiency and clarity. The changes are reflected throughout the TickBitmap module ensuring that all functions using this calculation are now updated.
This commit improves readability with clearer variable naming and avoids implicit upcasting in SqrtPriceMath.sol. We have replaced certain variable names for better understanding of the operations being carried out. This includes replacing `liquidity256` with `_liquidity`, and `sign` with `roundUp`. The commit also replaces `amount >> 160 == 0` check for overflow with `amount <= type(uint160).max`.
The changes center around improving code readability in TickMath.sol. The assembly block has been condensed for simplifying the flow of code. Also added are clarifying inline comments regarding the operations involving 'ratio' and 'sqrtPriceX96' variables.
Refactored the SwapMath module to optimize fee pips calculation. This was achieved by caching the feePips value to prevent redundant typecasts. This reduces computational overhead and may improve performance.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Latest optimizations from V4.