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

Added test case to show the bug described in #1853 #1854

Conversation

duelinggalois
Copy link
Contributor

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.

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.
@CLAassistant
Copy link

CLAassistant commented Apr 22, 2023

CLA assistant check
All committers have signed the CLA.

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.
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants