-
Notifications
You must be signed in to change notification settings - Fork 981
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
[Bug]: Library call function is not an instance of Function
#1622
Comments
I tried to figure this out after noticing it in the c4 audit for timeswap. As far as I can tell, the issue is that v2-option, v2-pool, and v2-token all have ParamLibrary contracts with The issue appears to be with ParamLibrary.check(param), which is only present in v2-pool and v2-token's ParamLibrary. v2-option's ParamLibrary.check functions all have a second parameter, I added some print statements throughout slither to try to debug. in slither/slithir/convert.py (around line 100):
Running slither . in packages/v2-token:
This is occurring in TimeswapV2Token.mint(TimeswapV2TokenMintParam) (as you've stated above). It's using check(TimeswapV2TokenMintParam memory param) from v2-token's ParamLibrary. Running slither . in packages/v2-pool gets the same result:
This one was occurring in TimeswapV2Pool.collectProtocolFees(TimeswapV2PoolCollectParam). This time it's using check(TimeswapV2PoolCollectParam memory param) from v2-pool's ParamLibrary. All of v2-option's ParamLibrary.check functions have an additional uint96 input I haven't been able to pinpoint where the mismatch is originating, but it appears that there's some sort of incorrect assignment that matches the v2-pool and v2-token ParamLibrary.check functions to v2-option's ParamLibrary file and contract. I tried to backtrack to find the error but kind of hit a dead end. If someone more familiar with the codebase knows where this might be occurring, I could take another look and try to fix it. I have no idea why this is causing it to throw an AssertionError on |
@0xGusMcCrae, thanks for taking the time tracking this down. Based off the duplicate function names, I suspect this may be fixed by #1625 but I need to double check |
To add something more the issue appears when parsing an expression. The
slither/slither/solc_parsing/expressions/find_variable.py Lines 405 to 407 in 0ec4874
|
@smonicas this is similar to the issue outlined in #1809 (comment) |
The problem is that slither/slither/core/scope/scope.py Line 32 in 0ec4874
slither/slither/core/scope/scope.py Lines 68 to 70 in 0ec4874
|
Any issue that can be fixed directly in Slither is fixed in #2404 so this is blocked on foundry-rs/foundry#7591 |
Describe the issue:
Library call function is not an instance of
Function
Related with this library call here https://github.com/code-423n4/2023-01-timeswap/blob/ef4c84fb8535aad8abd6b67cc45d994337ec4514/packages/v2-option/src/TimeswapV2Option.sol#L112
Code example to reproduce the issue:
Version:
0.9.2
Relevant log output:
The text was updated successfully, but these errors were encountered: