Skip to content

Conversation

@edlsh
Copy link

@edlsh edlsh commented Dec 20, 2025

Fixes #2073

Problem

The function-summary printer incorrectly classified all member access expressions (x.foo()) as external calls, including:

  • Solidity built-ins: abi.encode(), abi.decode()
  • Library calls: SafeMath.add() (direct and via using X for Y)

Solution

  • Parse-time filtering in _classify_calls() for built-ins and direct library calls
  • IR-based high_level_calls - library_calls in get_summary() for using X for Y accuracy

Includes regression test covering all cases.

…external

Fixes crytic#2073

The function-summary printer was incorrectly classifying all member access
expressions (x.foo()) as external calls, including:
- Solidity built-ins: abi.encode(), abi.decode(), etc.
- Library calls: SafeMath.add(), both direct and via 'using X for Y'
- Struct field access: data.value

Changes:
- solc_parsing/cfg/node.py: Add _classify_calls() to properly filter
  Solidity built-ins and direct library calls at parse time
- core/declarations/function_contract.py: Use IR-based high_level_calls
  minus library_calls for accurate external call reporting in get_summary()
- core/declarations/function_top_level.py: Same fix for top-level functions
- tests/e2e/printers/: Add regression test covering all cases

Note: this.foo() is correctly classified as external (uses CALL opcode).
@edlsh edlsh requested a review from smonicas as a code owner December 20, 2025 13:04
@CLAassistant
Copy link

CLAassistant commented Dec 20, 2025

CLA assistant check
All committers have signed the CLA.

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.

2 participants