Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Dharma-09 authored Nov 2, 2023
0 parents commit 714f3d2
Show file tree
Hide file tree
Showing 11 changed files with 9,173 additions and 0 deletions.
48 changes: 48 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Feel free to open PRs or open issues within this repository.

To add an issue to the analyzer, you have 2 choices:

- use a detector based on a simple regex
- use a detector based on the analysis of the Abstract Syntax Tree generated by the `solc` compiler

### Regex-based detector:

Examples:

- [Cache Array Length](src/issues/GAS/cacheArrayLength.ts)
- [Custom Errors](src/issues/GAS/customErrors.ts)

Following this type, just add a file in the `issues/<X>` folder:

```js
type RegexIssue = {
type: IssueTypes.GAS | IssueTypes.NC | IssueTypes.L | IssueTypes.M | IssueTypes.H,
regex: RegExp,
title: string,
impact?: string,
description?: string,
regexOrAST: 'Regex',
};
```

### AST-based detector:

Examples:

- [Use Assembly when querying balances](src/issues/GAS/addressBalance.ts)
- [Use Assembly to check `address != 0`](src/issues/GAS/addressZero.ts)

Following this type, just add a file in the `issues/<X>` folder:

```js
type ASTIssue = {
type: IssueTypes.GAS | IssueTypes.NC | IssueTypes.L | IssueTypes.M | IssueTypes.H,
title: string,
impact?: string,
description?: string,
detector: (files: InputType) => Instance[], // Function analyzing the AST and returning instances of the issue
regexOrAST: 'AST',
};
```


674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading

0 comments on commit 714f3d2

Please sign in to comment.