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

fixed: pausable printer includes checks on constructor() #1824

Merged
merged 3 commits into from
Apr 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions slither/printers/summary/when_not_paused.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@


def _use_modifier(function: Function, modifier_name: str = "whenNotPaused") -> bool:
if function.is_constructor or function.view or function.pure:
return False

for internal_call in function.all_internal_calls():
if isinstance(internal_call, SolidityFunction):
Expand All @@ -23,7 +21,7 @@ def _use_modifier(function: Function, modifier_name: str = "whenNotPaused") -> b

class PrinterWhenNotPaused(AbstractPrinter):

ARGUMENT = "pausable"
ARGUMENT = "not-pausable"
HELP = "Print functions that do not use whenNotPaused"

WIKI = "https://github.com/trailofbits/slither/wiki/Printer-documentation#when-not-paused"
Expand All @@ -46,6 +44,8 @@ def output(self, _filename: str) -> output.Output:
table = MyPrettyTable(["Name", "Use whenNotPaused"])

for function in contract.functions_entry_points:
if function.is_constructor or function.view or function.pure:
continue
status = "X" if _use_modifier(function, modifier_name) else ""
table.add_row([function.solidity_signature, status])

Expand Down