Skip to content

Commit

Permalink
Merge branch 'dev' into dev-improve-reentrancy
Browse files Browse the repository at this point in the history
  • Loading branch information
montyly committed Nov 28, 2022
2 parents 81f0e70 3cba359 commit 200c5ce
Show file tree
Hide file tree
Showing 380 changed files with 8,484 additions and 436 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 25,7 @@ jobs:
type: ["cli",
"dapp",
"data_dependency",
"path_filtering",
# "embark",
"erc",
# "etherlime",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 45,7 @@ jobs:
- name: Test with pytest
run: |
pytest tests/test_features.py
pytest tests/test_constant_folding_unary.py
pytest tests/test_constant_folding.py
pytest tests/slithir/test_ternary_expressions.py
pytest tests/test_functions_ids.py
pytest tests/test_function.py
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 47,7 @@ coverage.xml
*.cover
.hypothesis/
.vscode/
storage_layout.json
# Translations
*.mo
*.pot
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 68,8 @@ To see the tests coverage, run `pytest tests/test_detectors.py --cov=slither/d

### Parser tests
- Create a test in `tests/ast-parsing`
- Run `python ./tests/test_ast_parsing.py --compile`. This will compile the artifact in `tests/compile`. Add the compiled artifact to git.
- Run `python ./tests/test_ast_parsing.py --generate`. This will generate the json artifacts in `tests/expected_json`. Add the generated files to git.
- Run `python ./tests/test_ast_parsing.py --compile`. This will compile the artifact in `tests/ast-parsing/compile`. Add the compiled artifact to git.
- Run `python ./tests/test_ast_parsing.py --generate`. This will generate the json artifacts in `tests/ast-parsing/expected_json`. Add the generated files to git.
- Run `pytest ./tests/test_ast_parsing.py` and check that everything worked.

To see the tests coverage, run `pytest tests/test_ast_parsing.py --cov=slither/solc_parsing --cov-branch --cov-report html`
Expand Down
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 26,14 @@ RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y --no-install-recommends python3-pip \
&& rm -rf /var/lib/apt/lists/*

# improve compatibility with amd64 solc in non-amd64 environments (e.g. Docker Desktop on M1 Mac)
ENV QEMU_LD_PREFIX=/usr/x86_64-linux-gnu
RUN if [ ! "$(uname -m)" = "x86_64" ]; then \
export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get install -y --no-install-recommends libc6-amd64-cross \
&& rm -rf /var/lib/apt/lists/*; fi

RUN useradd -m slither
USER slither

Expand Down
158 changes: 80 additions & 78 deletions README.md

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions plugin_example/slither_my_plugin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 1,13 @@
from typing import Tuple, List, Type

from slither_my_plugin.detectors.example import Example

from slither.detectors.abstract_detector import AbstractDetector
from slither.printers.abstract_printer import AbstractPrinter


def make_plugin():
def make_plugin() -> Tuple[List[Type[AbstractDetector]], List[Type[AbstractPrinter]]]:
plugin_detectors = [Example]
plugin_printers = []
plugin_printers: List[Type[AbstractPrinter]] = []

return plugin_detectors, plugin_printers
6 changes: 3 additions & 3 deletions scripts/ci_test_cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 4,17 @@

solc-select use 0.7.0

if ! slither "tests/config/test.sol" --solc-ast; then
if ! slither "tests/config/test.sol" --solc-ast --no-fail-pedantic; then
echo "--solc-ast failed"
exit 1
fi

if ! slither "tests/config/test.sol" --solc-disable-warnings; then
if ! slither "tests/config/test.sol" --solc-disable-warnings --no-fail-pedantic; then
echo "--solc-disable-warnings failed"
exit 1
fi

if ! slither "tests/config/test.sol" --disable-color; then
if ! slither "tests/config/test.sol" --disable-color --no-fail-pedantic; then
echo "--disable-color failed"
exit 1
fi
15 changes: 15 additions & 0 deletions scripts/ci_test_path_filtering.sh
Original file line number Diff line number Diff line change
@@ -0,0 1,15 @@
#!/usr/bin/env bash

### Test path filtering across POSIX and Windows

solc-select use 0.8.0
slither "tests/test_path_filtering/test_path_filtering.sol" --config "tests/test_path_filtering/slither.config.json" > "output.txt" 2>&1

if ! grep -q "0 result(s) found" "output.txt"
then
echo "Path filtering across POSIX and Windows failed"
rm output.txt
exit 5
else
rm output.txt
fi
4 changes: 2 additions & 2 deletions scripts/ci_test_truffle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 14,9 @@ nvm use --lts
npm install -g truffle
truffle unbox metacoin

if ! slither .; then
if ! slither . --no-fail-pedantic; then
echo "Truffle test failed"
exit 1
fi

exit 0
exit 0
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 8,14 @@
description="Slither is a Solidity static analysis framework written in Python 3.",
url="https://github.com/crytic/slither",
author="Trail of Bits",
version="0.8.3",
version="0.9.0",
packages=find_packages(),
python_requires=">=3.8",
install_requires=[
"prettytable>=0.7.2",
"pysha3>=1.0.2",
# "crytic-compile>=0.2.3",
"crytic-compile",
"pycryptodome>=3.4.6",
"crytic-compile>=0.2.4",
# "crytic-compile@git https://github.com/crytic/crytic-compile.git@master#egg=crytic-compile",
],
extras_require={
"dev": [
Expand All @@ -28,7 28,6 @@
"solc-select>=v1.0.0b1",
]
},
dependency_links=["git https://github.com/crytic/crytic-compile.git@master#egg=crytic-compile"],
license="AGPL-3.0",
long_description=long_description,
long_description_content_type="text/markdown",
Expand All @@ -45,6 44,7 @@
"slither-prop = slither.tools.properties.__main__:main",
"slither-mutate = slither.tools.mutator.__main__:main",
"slither-read-storage = slither.tools.read_storage.__main__:main",
"slither-doctor = slither.tools.doctor.__main__:main",
]
},
)
Loading

0 comments on commit 200c5ce

Please sign in to comment.