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 is unable to accurately determine the output of abi.decoder #15017

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

Comments

@Subway2023
Copy link

Description

SMTChecker is unable to determine whether the decoded value after using abi.decode is equal to the initial value encoded using abi.encode.

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{    
  function f() public{
      bytes memory corrupt = abi.encode(uint(1));
      uint decoded = abi.decode(corrupt, (uint));
      assert(decoded==1);
  }
}
solc C.sol --model-checker-engine all

1712927870497

@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 blishko removed the bug 🐛 label Apr 29, 2024
@blishko
Copy link
Contributor

blishko commented Apr 29, 2024

SMTChecker cannot model precisely what ABI methods like encode and decode 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.
This 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
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