Skip to content

Fix function-summary printer incorrectly classifying internal calls as external#2993

Open
cats2101 wants to merge 1 commit intocrytic:masterfrom
cats2101:fix/function-summary-external-calls
Open

Fix function-summary printer incorrectly classifying internal calls as external#2993
cats2101 wants to merge 1 commit intocrytic:masterfrom
cats2101:fix/function-summary-external-calls

Conversation

@cats2101
Copy link
Copy Markdown

@cats2101 cats2101 commented Apr 1, 2026

Summary

  • Replace heuristic external_calls_as_expressions with IR-based high_level_calls filtering (excluding LibraryCall) in get_summary() for both FunctionContract and FunctionTopLevel
  • external_calls_as_expressions matches any expression containing a ., which misclassifies bytes.concat(), abi.encode(), library calls, and similar dotted expressions as external calls
  • high_level_calls uses the SlithIR intermediate representation, which correctly distinguishes actual external contract calls from other dotted syntax

Closes #2073

Test plan

  • Verify slither . --print function-summary no longer lists bytes.concat(), abi.encode(), or library calls under external calls
  • Verify actual external calls (e.g., token.transfer()) still appear correctly
  • Run existing printer e2e tests

The get_summary() method used external_calls_as_expressions, a heuristic
that misclassifies dotted expressions like bytes.concat(), abi.encode(),
and library calls as external calls. Replace with high_level_calls
filtered to exclude LibraryCall, which is definitively correct.

Closes crytic#2073
@cats2101 cats2101 requested a review from smonicas as a code owner April 1, 2026 08:55
@cats2101
Copy link
Copy Markdown
Author

Gentle ping — anything else needed here?

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.

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

1 participant