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

Increase granularity dataflow analysis #2313

Closed
JoranHonig opened this issue Feb 19, 2024 · 1 comment
Closed

Increase granularity dataflow analysis #2313

JoranHonig opened this issue Feb 19, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@JoranHonig
Copy link

Describe the desired feature

I was playing around with slither and trying to write an analysis module to do the following:

  1. find all modifier implementations
  2. in each modifier find each equivalence comparison and mark them
  3. find all execution paths where a marked variable remains unchecked
modifier example {
        bool intermediate = msg.sender == owner; // should not trigger here
        require(intermediate);
}

However, the problem seems to be as follows:

Statement 1's IR statements roughly looks like this:
tmp_0 = comparison
intermediate = tmp_0

Unfortunately, I believe the available dataflow libraries do not allow me to then check whether the local variable in the require statement depends on the temporary variable in the IR expansion of the earlier statement.

Lmk if I'm missing something here 🙏 .

@JoranHonig JoranHonig added the enhancement New feature or request label Feb 19, 2024
@0xalpharush
Copy link
Contributor

0xalpharush commented Feb 19, 2024

This looks like a regression caused by #1984 which should be fixed by #2201. The SSA IR was not being created correctly (run slither --print slithir-ssa) due to the is_reachable property not being set (this affects the dominator calculation and thus SSA generation and data dependency analysis). We should have caught this in testing so I will make sure a data dependency and SSA IR for modifiers is running in CI

cc @Tiko7454

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants