-
Notifications
You must be signed in to change notification settings - Fork 982
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
Added test case to show the bug described in #1853 #1854
Closed
duelinggalois
wants to merge
2
commits into
crytic:dev
from
duelinggalois:fix/added-test-for-decoding-contract-array
Closed
Added test case to show the bug described in #1853 #1854
duelinggalois
wants to merge
2
commits into
crytic:dev
from
duelinggalois:fix/added-test-for-decoding-contract-array
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
Test case reproduces the error described in crytic#1853. I found a quick and dirty hack to fix it locally, but it looks like my hack does not work in the test suite so I did not add it.
partial fix of crytic#1853 AssertionError with stack trace can occur while parsing contracts that provides no context to what was parsed that threw the error as described in crytic#1853. This change catches this error, logges additional context, and then throws the error again. An example of the logging from code I am working on: ``` $ slither . ... Compiler run successful ERROR:SlitherSolcParsing:Failed to parse MyERC20Controller.constructor (contracts/MyERC20Controller.sol#19-25): (tokenX,tokenY) = IMyFactoryCallback(msg.sender).tokens() (success,data) = msg.sender.delegatecall(abi.encodeWithSelector(IMyFactoryCallback.newTokens.selector,tokenX,tokenY)) require(bool,string)(success,Factory new tokens failed) _tokens = abi.decode(data,(IMyERC20[6])) # <--------------Failing line Traceback (most recent call last): File "~/slither/slither/__main__.py", line 810, in main_impl ) = process_all(filename, args, detector_classes, printer_classes) File "~/slither/slither/__main__.py", line 101, in process_all ... ``` Logging should make it easier for further issues from users to be easily understood and if necessary included in a bug report.
0xalpharush
reviewed
Apr 25, 2023
0xalpharush
reviewed
Apr 25, 2023
0xalpharush
reviewed
Apr 25, 2023
duelinggalois
added a commit
to duelinggalois/slither
that referenced
this pull request
Apr 28, 2023
partial fix of crytic#1853 Opened PR per request in crytic#1854 AssertionError with stack trace can occur while parsing contracts that provides no context to what was parsed that threw the error as described in crytic#1853. This change catches this error, logs additional context, and then throws the error again. An example of the logging from code I am working on: ``` $ slither . ... Compiler run successful ERROR:SlitherSolcParsing: Failed to parse MyERC20Controller.constructor (contracts/MyERC20Controller.sol#19-25): (tokenX,tokenY) = IMyFactoryCallback(msg.sender).tokens() (success,data) = msg.sender.delegatecall(abi.encodeWithSelector(IMyFactoryCallback.newTokens.selector,tokenX,tokenY)) require(bool,string)(success,Factory new tokens failed) _tokens = abi.decode(data,(IMyERC20[6])) Traceback (most recent call last): File "~/slither/slither/__main__.py", line 810, in main_impl ) = process_all(filename, args, detector_classes, printer_classes) File "~/slither/slither/__main__.py", line 101, in process_all ... ``` Logging should make it easier for further issues from users to be easily understood and if necessary included in a bug report.
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.
Test case reproduces the error described in #1853. I found a quick and dirty hack to fix it locally, but it looks like my hack does not work in the test suite so I did not add it.