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

Detect unused local variables (including in Yul blocks) #2324

Open
mds1 opened this issue Feb 20, 2024 · 2 comments
Open

Detect unused local variables (including in Yul blocks) #2324

mds1 opened this issue Feb 20, 2024 · 2 comments

Comments

@mds1
Copy link
Contributor

mds1 commented Feb 20, 2024

What bug did Slither miss and which detector did you anticipate would catch it?

  1. Clone the optimism repo and cd packages/contracts-bedrock.
  2. Open L1Block.sol and in setL1BlockValuesEcotone, notice the unused let data := calldataload(4).
  3. Update the slither.config.json so no checks are excluded.
  4. Run slither . (side error: running slither ./src/L2/L1Block.sol gives a compilation error that I haven't looked into yet), which does not find the unused data variable.

Frequency

Not sure

Code example to reproduce the issue:

See above

Version:

0.10.0

Relevant log output:

No response

@0xalpharush
Copy link
Member

We have worked some on an unused-local detector but haven't released it due to FPs. Is there another detector you thought would catch this?

@mds1
Copy link
Contributor Author

mds1 commented Feb 20, 2024

Ah, I thought I'd seen unused variables in the past but perhaps unused-state-variable is what I was remembering. In which case, we can convert this into a feature request

@0xalpharush 0xalpharush changed the title [False Negative]: Unused variable in assembly not found Detect unused local variables (including in Yul blocks) Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants