-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(repo): add slither to lint code (#1)
* feat: add slither * fix: resolve bugs checked by slither * feat: add mythril * ci: add scopes * ci: add lint ci
- Loading branch information
1 parent
4685017
commit fd8b9ec
Showing
38 changed files
with
249 additions
and
193 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 |
---|---|---|
|
@@ -18,4 +18,9 @@ jobs: | |
with: | ||
scopes: | | ||
repo | ||
ci | ||
lint | ||
doc | ||
test | ||
script | ||
requireScope: true |
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 |
---|---|---|
|
@@ -6,8 +6,7 @@ on: | |
pull_request: | ||
|
||
jobs: | ||
solidity: | ||
name: Lint Solidity Code | ||
solhint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
@@ -17,5 +16,17 @@ jobs: | |
- name: Install pnpm dependencies | ||
uses: ./.github/actions/install-pnpm-dependencies | ||
|
||
- name: lint commit msg | ||
- name: lint solidity code | ||
run: pnpm lint:sol | ||
|
||
commitlint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: wagoid/commitlint-github-action@v5 | ||
|
||
slihter: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: crytic/[email protected] |
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 |
---|---|---|
|
@@ -6,3 +6,4 @@ lib | |
out | ||
cache | ||
broadcast | ||
.vscode/slither-results.json |
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
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
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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
{ | ||
"cSpell.words": ["commitlint", "mixedcase", "solhint"], | ||
"solidity.compileUsingRemoteVersion": "v0.8.21+commit.d9974bed", | ||
"cSpell.words": ["commitlint", "mixedcase", "remappings", "solhint"], | ||
|
||
"[solidity]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
} | ||
}, | ||
"solidity.compileUsingRemoteVersion": "v0.8.18+commit.87f61d96", | ||
"slither.solcPath": "", | ||
"slither.hiddenDetectors": [] | ||
} |
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
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
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,12 @@ | ||
#!/bin/bash | ||
|
||
# slither | ||
pip3 install slither-analyzer | ||
pip3 install solc-select | ||
solc-select install 0.8.18 | ||
solc-select use 0.8.18 | ||
|
||
#mythril | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | ||
rustup default nightly | ||
pip3 install mythril |
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,12 @@ | ||
{ | ||
"remappings": [ | ||
"ds-test/=lib/ds-test/src/", | ||
"forge-std/=lib/forge-std/src/", | ||
"@openzeppelin/contracts=node_modules/@openzeppelin/contracts", | ||
"@openzeppelin/contracts-upgradeable=node_modules/@openzeppelin/contracts-upgradeable" | ||
], | ||
"optimizer": { | ||
"enabled": true, | ||
"runs": 200 | ||
} | ||
} |
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
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,22 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.18; | ||
|
||
import "forge-std/Script.sol"; // solhint-disable | ||
import {TPCounterV1} from "../src/TPCounterV1.sol"; | ||
import {DeployTPScript} from "./DeployTPScript.s.sol"; | ||
|
||
contract DeployTPCounterV1 is DeployTPScript { | ||
address private immutable _deployer; | ||
|
||
constructor() DeployTPScript(vm.envUint("PRIVATE_KEY")) { | ||
_deployer = vm.envAddress("DEPLOYER"); | ||
} | ||
|
||
//slither-disable-next-line reentrancy-no-eth | ||
function _run() internal override deploy(_deployer) { | ||
TPCounterV1 c = new TPCounterV1(); | ||
implementation = address(c); | ||
data = bytes.concat(c.initialize.selector); | ||
} | ||
} |
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,21 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.18; | ||
|
||
import "forge-std/Script.sol"; // solhint-disable | ||
|
||
import {TPCounterV2} from "../src/TPCounterV2.sol"; | ||
import {DeployTPScript} from "./DeployTPScript.s.sol"; | ||
|
||
contract DeployTPCounterV2 is DeployTPScript { | ||
constructor() DeployTPScript(vm.envUint("PRIVATE_KEY")) { | ||
proxyAddress = vm.envAddress("PROXY"); | ||
} | ||
|
||
//slither-disable-next-line reentrancy-no-eth | ||
function _run() internal override upgrade { | ||
TPCounterV2 c = new TPCounterV2(); | ||
implementation = address(c); | ||
data = bytes.concat(c.upgradeVersion.selector); | ||
} | ||
} |
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
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,18 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.18; | ||
|
||
import "forge-std/Script.sol"; // solhint-disable | ||
import {UUPSCounterV1} from "../src/UUPSCounterV1.sol"; | ||
import {DeployUUPSScript} from "./DeployUUPSScript.s.sol"; | ||
|
||
contract DeployUUPSCounterV1 is DeployUUPSScript { | ||
constructor() DeployUUPSScript(vm.envUint("PRIVATE_KEY")) {} | ||
|
||
//slither-disable-next-line reentrancy-no-eth | ||
function _run() internal override deploy { | ||
UUPSCounterV1 c = new UUPSCounterV1(); | ||
implementation = address(c); | ||
data = bytes.concat(c.initialize.selector); | ||
} | ||
} |
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,20 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.18; | ||
|
||
import "forge-std/Script.sol"; // solhint-disable-line | ||
import {UUPSCounterV2} from "../src/UUPSCounterV2.sol"; | ||
import {DeployUUPSScript} from "./DeployUUPSScript.s.sol"; | ||
|
||
contract DeployUUPSCounterV2 is DeployUUPSScript { | ||
constructor() DeployUUPSScript(vm.envUint("PRIVATE_KEY")) { | ||
proxyAddress = vm.envAddress("PROXY"); | ||
} | ||
|
||
//slither-disable-next-line reentrancy-no-eth | ||
function _run() internal override upgrade { | ||
UUPSCounterV2 c = new UUPSCounterV2(); | ||
implementation = address(c); | ||
data = bytes.concat(c.upgradeVersion.selector); | ||
} | ||
} |
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
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,2 @@ | ||
#!/bin/bash | ||
source .env && forge script script/transparent/DeployTPCounterV1.s.sol --rpc-url ${RPC_URL} --broadcast -vvvv |
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,2 @@ | ||
#!/bin/bash | ||
source .env && forge script script/transparent/DeployTPCounterV2.s.sol --rpc-url ${RPC_URL} --broadcast -vvvv |
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,2 @@ | ||
#!/bin/bash | ||
source .env && forge script script/uups/DeployUUPSCounterV1.s.sol --rpc-url ${RPC_URL} --broadcast -vvvv |
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,3 @@ | ||
#!/bin/bash | ||
# shellcheck disable=all | ||
source .env && forge script script/uups/DeployUUPSCounterV2.s.sol --rpc-url ${RPC_URL} --broadcast -vvvv |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.