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

SMTChecker: Unable to accurately determine the modification of global variables by functions called using call() #15018

Closed
Subway2023 opened this issue Apr 12, 2024 · 1 comment
Labels
Projects

Comments

@Subway2023
Copy link

Description

When a function called using call() modifies global variables, SMTChecker is unable to determine the final value of the global variables

Environment

  • Compiler version: 0.8.25
  • Target EVM version (as per compiler settings): No restrictions
  • Framework/IDE (e.g. Truffle or Remix): Command-line
  • EVM execution environment / backend / blockchain client: None
  • Operating system: Linux
contract Caller {
  int a;
  function f() public {
      a=1;
  }
  function g()public{
      bytes memory payload=abi.encodeWithSignature("f()");
      address(this).call(payload);
      assert(a==1);
  }
}
solc C.sol --model-checker-engine all

1712928432696

@cameel cameel added the smt label Apr 12, 2024
@cameel cameel changed the title SMTChecker: SMTChecker: Unable to accurately determine the modification of global variables by functions called using call() SMTChecker: Unable to accurately determine the modification of global variables by functions called using call() Apr 12, 2024
@blishko blishko added this to To Do in SMT Checker via automation Apr 25, 2024
@blishko
Copy link
Contributor

blishko commented Apr 29, 2024

SMTChecker cannot model precisely what ABI methods like encodeWithSignature compute.
To stay sound, it over-approximates the possible behaviour.
This means that it only models the basic functional property: they yield equal output for equal inputs.
Otherwise, it assumes that the result can be any value.

Similarly, it over-approximates the behaviour of call method. This can potentially call any external code, which can do anything.
This over-approximating modeling results in false positives that you see in this issue, but keeps the encoding sane.

@blishko blishko closed this as not planned Won't fix, can't repro, duplicate, stale Apr 29, 2024
SMT Checker automation moved this from To Do to Done Apr 29, 2024
@blishko blishko removed the bug 🐛 label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
SMT Checker
  
Done
Development

No branches or pull requests

3 participants