NioTheFirst / ScType

GNU Affero General Public License v3.0
8 stars 3 forks source link

KeyError: 'function' with Slither in SCType #1

Open melvn opened 3 months ago

melvn commented 3 months ago

KeyError: 'function' when running Slither 0.9.3 for static analysis

Description

I'm encountering a persistent KeyError: 'function' when running Slither 0.9.3 for static analysis on Solidity smart contracts as part of the ScType tool. Notably, this error doesn't occur within the Docker environment where Slither runs successfully. The error persists across various contracts, unrelated to specific code patterns. I'm also able to reproduce the issue with the Benchmarks folder from the ScType_data repository, with all projects analysed successfully, issues only begin to arise when I attempt to analyse my own contracts after building from source.

Environment

Key Observations

Reproduction Steps

  1. Downgrade Slither to 0.9.3.
  2. Set solc to 0.8.21. (0.8.21 itself, is purely coincidental. My contracts use this version for compilation)
  3. Run slither --detect tcheck command on a contract, triggering the KeyError: 'function'.

Attempted Solutions

Request for Insight

  1. Any known compatibility issues between Slither 0.9.3, Solidity 0.8.21, and the Sc-Type integration that could lead to this KeyError?
  2. Differences in Slither's behavior outside Docker that might contribute to this issue?
  3. Suggestions for bridging this gap between Docker success and local failure in the analysis process?

Appreciate any guidance or solution for addressing this issue, I enjoyed your paper and found it well written with a lot of potential usefulness. Thank you.

Terminal Output with Slither 0.10.1

uptodateslither

Terminal Output with Slither 0.9.3

oldslither1

oldslither2

NioTheFirst commented 2 months ago

Hello!

I apologize for the delay.

If you are still having troubles with this issue, a potential issue could be that you are trying to run this tool by directly installing Slither. However, this tool is not directly implemented on Slither (i.e. downloading slither does not result in the tool being downloaded).

I would recommend installing the tool via the installation instructions in ScType-README-dev.md. Please let me know if the issue persists.

melvn commented 2 months ago

Thank-you for the response, I do understand what you are suggesting but that is unlikely the case for me, Im not installing any version of form of the static analyzer at all, this is on a fresh ubuntu install and only your repo has been cloned on it. I have been (and am) using the dev readme install since the beginning, I haven't tried installing anything slither related with the only version in use being the 0.9.3 build that comes with the cloned repo.

Below are some commands and their outputs I've run to attempt to locate the slither issue:

slither --version

Output: 0.9.3

This is in accordance with the projects requested slither build.

pip3 list | grep slither

Output: slither analyzer 0.9.3

Again showing only the required version of slither is being used & installed on my system.

Is it possible you could try to reproduce the issue or suggest an alternative source build option/process? Im still very interested in running ScType and am patiently waiting on your response.