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 reverting tests, fix fuzz for hooks.t.sol #548

Merged
merged 10 commits into from
May 17, 2024
Merged

Conversation

snreynolds
Copy link
Member

Related Issue

Which issue does this pull request resolve?

Description of changes

Copy link

github-actions bot commented Apr 2, 2024

Forge code coverage:

File % Lines % Statements % Branches % Funcs
src/ERC6909.sol 91.30% (21/23) 85.71% (24/28) 100.00% (4/4) 85.71% (6/7)
src/ERC6909Claims.sol 100.00% (6/6) 100.00% (8/8) 100.00% (4/4) 100.00% (1/1)
src/Extsload.sol 100.00% (3/3) 100.00% (4/4) 100.00% (0/0) 100.00% (3/3)
src/Exttload.sol 100.00% (1/1) 100.00% (1/1) 100.00% (0/0) 50.00% (1/2)
src/NoDelegateCall.sol 100.00% (3/3) 100.00% (5/5) 100.00% (2/2) 100.00% (3/3)
src/PoolManager.sol 100.00% (82/82) 99.11% (111/112) 97.22% (35/36) 100.00% (18/18)
src/ProtocolFees.sol 100.00% (20/20) 97.06% (33/34) 91.67% (11/12) 100.00% (6/6)
src/libraries/BitMath.sol 100.00% (47/47) 100.00% (57/57) 100.00% (36/36) 100.00% (2/2)
src/libraries/CurrencyDelta.sol 100.00% (4/4) 100.00% (6/6) 100.00% (0/0) 100.00% (3/3)
src/libraries/CurrencySettleTake.sol 100.00% (10/10) 100.00% (10/10) 50.00% (3/6) 100.00% (2/2)
src/libraries/FullMath.sol 100.00% (29/29) 100.00% (33/33) 100.00% (8/8) 100.00% (2/2)
src/libraries/Hooks.sol 100.00% (78/78) 100.00% (144/144) 100.00% (58/58) 100.00% (15/15)
src/libraries/LPFeeLibrary.sol 100.00% (10/10) 100.00% (18/18) 100.00% (4/4) 100.00% (7/7)
src/libraries/LiquidityMath.sol 100.00% (2/2) 100.00% (1/1) 100.00% (1/1) 100.00% (1/1)
src/libraries/Lock.sol 100.00% (4/4) 100.00% (4/4) 100.00% (0/0) 100.00% (3/3)
src/libraries/NonZeroDeltaCount.sol 100.00% (6/6) 100.00% (6/6) 100.00% (0/0) 100.00% (3/3)
src/libraries/ParseBytes.sol 100.00% (3/3) 100.00% (3/3) 100.00% (0/0) 100.00% (3/3)
src/libraries/Pool.sol 99.34% (151/152) 98.26% (169/172) 94.32% (83/88) 100.00% (13/13)
src/libraries/PoolGetters.sol 66.67% (2/3) 66.67% (2/3) 100.00% (0/0) 66.67% (2/3)
src/libraries/Position.sol 100.00% (11/11) 100.00% (12/12) 100.00% (4/4) 100.00% (2/2)
src/libraries/ProtocolFeeLibrary.sol 100.00% (4/4) 100.00% (6/6) 100.00% (0/0) 100.00% (4/4)
src/libraries/Reserves.sol 100.00% (8/8) 100.00% (13/13) 100.00% (6/6) 100.00% (3/3)
src/libraries/SafeCast.sol 100.00% (10/10) 100.00% (26/26) 100.00% (10/10) 100.00% (6/6)
src/libraries/SqrtPriceMath.sol 100.00% (32/32) 100.00% (66/66) 87.50% (21/24) 100.00% (8/8)
src/libraries/StateLibrary.sol 100.00% (65/65) 100.00% (94/94) 100.00% (4/4) 100.00% (14/14)
src/libraries/SwapMath.sol 100.00% (23/23) 100.00% (30/30) 100.00% (12/12) 100.00% (1/1)
src/libraries/TickBitmap.sol 100.00% (19/19) 100.00% (34/34) 100.00% (6/6) 100.00% (3/3)
src/libraries/TickMath.sol 100.00% (94/94) 100.00% (148/148) 97.83% (45/46) 100.00% (4/4)
src/libraries/TransientStateLibrary.sol 88.89% (8/9) 85.71% (12/14) 100.00% (0/0) 75.00% (3/4)
src/libraries/UnsafeMath.sol 100.00% (1/1) 100.00% (1/1) 100.00% (0/0) 100.00% (1/1)
src/types/BalanceDelta.sol 100.00% (2/2) 100.00% (2/2) 100.00% (0/0) 100.00% (2/2)
src/types/BeforeSwapDelta.sol 100.00% (2/2) 100.00% (2/2) 100.00% (0/0) 100.00% (2/2)
src/types/Currency.sol 100.00% (15/15) 95.83% (23/24) 100.00% (10/10) 100.00% (6/6)
src/types/PoolId.sol 100.00% (1/1) 100.00% (1/1) 100.00% (0/0) 100.00% (1/1)
src/types/Slot0.sol 100.00% (8/8) 100.00% (8/8) 100.00% (0/0) 100.00% (8/8)
Total 84.04% (1385/1648) 84.38% (1912/2266) 62.01% (519/837) 76.90% (323/420)

Copy link
Contributor

@hensha256 hensha256 left a comment

Choose a reason for hiding this comment

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

Just a few cleanup things but great new tests

// Set the upper `hooksPermissionCount` number of bits to get the full mask in uint16.
uint16 allHooksMask = (~uint16(0) << uint16(16 - hookPermissionCount));
// We want any combination except all hooks.
vm.assume(mask < allHooksMask);
Copy link
Contributor

Choose a reason for hiding this comment

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

the name of the test is failsAllHooks as if it has all hooks - but this test explicitly doesnt have all hooks?

Copy link
Contributor

Choose a reason for hiding this comment

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

OH i see its that validateHookPermissions has all hooks

hensha256
hensha256 previously approved these changes May 17, 2024
@dianakocsis
Copy link
Contributor

can you make all the import paths in Hooks.t.sol relative?

@dianakocsis
Copy link
Contributor

i forget, did we want to change the hook flags to be uint160 instead of uint256?

@snreynolds snreynolds merged commit 6786fd4 into main May 17, 2024
6 checks passed
@snreynolds snreynolds deleted the hooks-unit-tests branch May 17, 2024 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants