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

Pausable printer includes checks on constructor() #1671

Closed
devtooligan opened this issue Feb 19, 2023 · 4 comments
Closed

Pausable printer includes checks on constructor() #1671

devtooligan opened this issue Feb 19, 2023 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@devtooligan
Copy link
Contributor

Describe the issue:

Slither printer issues dialog that it wont report on constructors Constructor and pure/view functions are not displayed, then it reports on constructors

When fixing this, we should also consider the desired behavior if there are no applicable functions in a contract. Skip the contract all together, or list it with nothing beneath or n/a or something

This ticket could be completed along with #1670

$ slither ./demo/test.sol --print pausable

Constructor and pure/view functions are not displayed

Zero:
+---------------+-------------------+
|      Name     | Use whenNotPaused |
+---------------+-------------------+
| constructor() |                   |
+---------------+-------------------+

One:
+---------------+-------------------+
|      Name     | Use whenNotPaused |
+---------------+-------------------+
| constructor() |                   |
+---------------+-------------------+

Two:
+---------------+-------------------+
|      Name     | Use whenNotPaused |
+---------------+-------------------+
| constructor() |                   |
+---------------+-------------------+

Test:
+----------------+-------------------+
|      Name      | Use whenNotPaused |
+----------------+-------------------+
| constructor()  |                   |
|     test()     |                   |
| test2(uint256) |                   |
| test3(uint256) |                   |
|    test4()     |                   |
+----------------+-------------------+


### Code example to reproduce the issue:

see above

### Version:

0.9.2

### Relevant log output:

_No response_
@devtooligan devtooligan added the bug-candidate Bugs reports that are not yet confirmed label Feb 19, 2023
@0xalpharush 0xalpharush changed the title [Bug-Candidate]: Pausable printer includes checks on constructor() Pausable printer includes checks on constructor() Mar 17, 2023
@0xalpharush 0xalpharush added enhancement New feature or request good first issue Good for newcomers and removed bug-candidate Bugs reports that are not yet confirmed labels Mar 17, 2023
@0xalpharush
Copy link
Contributor

We need to add a check that like not function.is_constructor here

for function in contract.functions_entry_points:

def is_constructor(self) -> bool:

@aga7hokakological
Copy link
Contributor

I would like to take this issue if no one is working. Also as mentioned that #1670 needs to be completed along with this. In #1670 I just need to change the argument name right?

@0xalpharush
Copy link
Contributor

@aga7hokakological All yours! It'd be awesome if you submitted one PR each for this issue and #1670. Feel free to ask any questions here

@aga7hokakological
Copy link
Contributor

We need to add a check that like not function.is_constructor here

for function in contract.functions_entry_points:

So the check is already there in

https://github.com/crytic/slither/blob/master/slither/printers/summary/when_not_paused.py#L13

I just moved this line in the above block and used continue keyword instead of False. It seems to work for
Constructor and pure/view functions are not displayed this line now. That means it doesn't show the pure/view/constructor while printing but now it is not printing X for not paused. Working on that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants