[SMTChecker] Detect when known code can be trusted
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 29
Description
In the example below, the assertion is false because `D`'s code cannot be trusted while analyzing `C`. Since `C.d`'s address is a runtime value, it could point to an address that has the same interface as `D` but implements `f` differently, returning a value different than 0.
The only case where the SMTChecker can trust that `d` points to a contract that has the code from `D` is if `C` deploys it. We need to identify that, and only then can use `D.f`'s code for the analysis.
```
contract D {
function f() external pure returns (uint) {
return 0;
}
}
contract C {
D d;
constructor(D _d) public {
d = _d;
}
function f() public {
uint x = d.f();
assert(x == 0);
}
}
```
Contributor guide
Research direction
Start with the SMTChecker analysis of the supplied C and D contract example, focusing on how the runtime value of C.d is handled. Done means trusting D.f only when C deploys D, while preserving conservative analysis for other addresses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, solidity
- Domain
- blockchain, compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100