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 describe the balance #15014

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

SMTChecker: Unable to accurately describe the balance #15014

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

Comments

@Subway2023
Copy link

Description

Unable to correctly determine that the current balance is 0 after transferring out all balances.

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

Steps to Reproduce

contract C{
  address payable recipient;
  function f() public {
      bool success = recipient.send(address(this).balance);
      if (success) {
          assert(address(this).balance==0);
      }
  }
}
solc C.sol --model-checker-engine all

1712926835356

@cameel cameel added the smt label Apr 12, 2024
@blishko blishko self-assigned this Apr 25, 2024
@blishko blishko added this to To Do in SMT Checker via automation Apr 25, 2024
@blishko
Copy link
Contributor

blishko commented May 8, 2024

If you add the assumption that the recipient is different from the sender, require(recipient != address(this));, SMTChecker will prove that assertion holds.

While we could improve the analysis for this particular example, it is also not very realistic, because recipient here is always 0.
In general, you would want to make sure that you are not sending to yourself.

@blishko blishko closed this as not planned Won't fix, can't repro, duplicate, stale May 8, 2024
SMT Checker automation moved this from To Do to Done May 8, 2024
@blishko blishko removed the bug 🐛 label May 8, 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