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

[Bug]: all statements with . are reported as external calls #2073

Open
mds1 opened this issue Aug 1, 2023 · 1 comment
Open

[Bug]: all statements with . are reported as external calls #2073

mds1 opened this issue Aug 1, 2023 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@mds1
Copy link
Contributor

mds1 commented Aug 1, 2023

Describe the issue:

I ran slither . --print function-summary to view external calls for functions. The resulting "External Calls" column treats any statement with a . as an external call. This includes solidity built-ins like abi.encode, library accesses like Address.sendValue, and struct field accesses.

Code example to reproduce the issue:

git clone https://github.com/scopelift/pooltogether-governor-upgrade/
cd pooltogether-governor-upgrade
forge install
slither . --print function-summary

Version:

0.9.6

Relevant log output:

No response

@mds1 mds1 added the bug-candidate Bugs reports that are not yet confirmed label Aug 1, 2023
@mds1 mds1 changed the title [Bug-Candidate]: all statements with . are treated as external calls [Bug-Candidate]: all statements with . are reported as external calls Aug 1, 2023
@0xalpharush 0xalpharush added bug Something isn't working and removed bug-candidate Bugs reports that are not yet confirmed labels Apr 10, 2024
@0xalpharush 0xalpharush changed the title [Bug-Candidate]: all statements with . are reported as external calls [Bug]: all statements with . are reported as external calls Apr 10, 2024
@0xalpharush 0xalpharush added the good first issue Good for newcomers label Apr 10, 2024
@0xalpharush
Copy link
Member

0xalpharush commented Apr 10, 2024

Instead of using all call expressions (which include members like abi.encode), we should use the expression of the HighLevelCall filtered from all the operations (https://crytic.github.io/slither/slither/core/declarations/function.html#Function.all_slithir_operations)

[str(x) for x in self.external_calls_as_expressions],

EDIT: What external_calls_as_expressions returns seems wrong as the comment says it should be calls which create a message (new call frame). Instead I think it would work to filter out SolidityVariable here

c for c in self._node.calls_as_expression if not isinstance(c.called, Identifier)

c for c in self._node.calls_as_expression if not isinstance(c.called, Identifier)

c for c in self._node.calls_as_expression if not isinstance(c.called, Identifier)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants