crytic / crytic/contract-explorer

Error when attempting to jump to a file by clicking on an analysis result

Open
#30 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
36
Forks
8
PR merge metrics
No merged PRs in 30d

Description

Slither version: 0.8.3
Repository: https://github.com/fluidity-money/fluidity-app (specifically the `contracts/ethereum` directory)

I'm able to run slither through the extension just fine, and it shows up with a bunch of issues. However, when clicking on an issue to jump to the file containing the issue, I get a `Error: cannot read properties of undefined (reading 'length')` error.

You can reproduce it by doing the following:

1. Install slither version 0.8.3 (unsure if that matters)
2. Clone the repository from above
3. `cd` to the `contracts/ethereum` directory
4. Run `yarn`
5. Run `slither .` (it should run successfully now)
6. Run `slither` through the VSC extension.
7. Attempt to jump to an issue by clicking on it through the Slither Analysis tab

From my quick attempt at debugging this issue, it seems like the problem is in [this line of code](https://github.com/crytic/slither-vscode/blob/master/src/slitherResults.ts#L100):

```ts
export async function gotoResultCode(workspaceFolder : string, result : SlitherResult) {
try {
// If there are no elements for this check which map to source, we stop.
if (result.elements.length <= 0 || !result.elements[0].source_mapping) {

// ...
} catch (r) {
// Log our error.
Logger.error(r.message);
}
}
```

Here, `result.elements` is undefined.

Let me know if there's any other information I can provide to assist with this :)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in src/slitherResults.ts at gotoResultCode and reproduce the failure with the contracts/ethereum example and the listed Slither and yarn commands. Inspect the analysis result passed when selecting an issue, especially the missing elements value. Done means clicking an analysis result no longer raises the error and navigates to its source when source information is available.

Written by the indexing model from the issue text.

Assessment

Tech stack
solidity, typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.