-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 714f3d2
Showing
11 changed files
with
9,173 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}; | ||
``` | ||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
Oops, something went wrong.