-
Notifications
You must be signed in to change notification settings - Fork 981
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
Showing
414 changed files
with
2,229 additions
and
480 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 |
---|---|---|
|
@@ -36,6 +36,7 @@ jobs: | |
"etherscan", | ||
"find_paths", | ||
"flat", | ||
"interface", | ||
"kspec", | ||
"printers", | ||
# "prop" | ||
|
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,3 +1,9 @@ | ||
contract A{ | ||
pragma solidity 0.8.19; | ||
|
||
} | ||
error RevertIt(); | ||
|
||
contract Example { | ||
function reverts() external pure { | ||
revert RevertIt(); | ||
} | ||
} |
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,5 +1,16 @@ | ||
import "./a.sol"; | ||
|
||
contract B is A{ | ||
pragma solidity 0.8.19; | ||
|
||
enum B { | ||
a, | ||
b | ||
} | ||
|
||
contract T { | ||
Example e = new Example(); | ||
function b() public returns(uint) { | ||
B b = B.a; | ||
return 4; | ||
} | ||
} |
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,12 +1,20 @@ | ||
#!/usr/bin/env bash | ||
shopt -s extglob | ||
|
||
### Test slither-prop | ||
### Test slither-flat | ||
solc-select use 0.8.19 --always-install | ||
|
||
cd examples/flat || exit 1 | ||
|
||
if ! slither-flat b.sol; then | ||
echo "slither-flat failed" | ||
exit 1 | ||
fi | ||
|
||
SUFFIX="@(sol)" | ||
if ! solc "crytic-export/flattening/"*$SUFFIX; then | ||
echo "solc failed on flattened files" | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
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,95 @@ | ||
#!/usr/bin/env bash | ||
|
||
### Test slither-interface | ||
|
||
DIR_TESTS="tests/tools/interface" | ||
|
||
solc-select use 0.8.19 --always-install | ||
|
||
#Test 1 - Etherscan target | ||
slither-interface WETH9 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 | ||
DIFF=$(diff crytic-export/interfaces/IWETH9.sol "$DIR_TESTS/test_1.sol" --strip-trailing-cr) | ||
if [ "$DIFF" != "" ] | ||
then | ||
echo "slither-interface test 1 failed" | ||
cat "crytic-export/interfaces/IWETH9.sol" | ||
echo "" | ||
cat "$DIR_TESTS/test_1.sol" | ||
exit 255 | ||
fi | ||
|
||
|
||
#Test 2 - Local file target | ||
slither-interface Mock tests/tools/interface/ContractMock.sol | ||
DIFF=$(diff crytic-export/interfaces/IMock.sol "$DIR_TESTS/test_2.sol" --strip-trailing-cr) | ||
if [ "$DIFF" != "" ] | ||
then | ||
echo "slither-interface test 2 failed" | ||
cat "crytic-export/interfaces/IMock.sol" | ||
echo "" | ||
cat "$DIR_TESTS/test_2.sol" | ||
exit 255 | ||
fi | ||
|
||
|
||
#Test 3 - unroll structs | ||
slither-interface Mock tests/tools/interface/ContractMock.sol --unroll-structs | ||
DIFF=$(diff crytic-export/interfaces/IMock.sol "$DIR_TESTS/test_3.sol" --strip-trailing-cr) | ||
if [ "$DIFF" != "" ] | ||
then | ||
echo "slither-interface test 3 failed" | ||
cat "crytic-export/interfaces/IMock.sol" | ||
echo "" | ||
cat "$DIR_TESTS/test_3.sol" | ||
exit 255 | ||
fi | ||
|
||
#Test 4 - exclude structs | ||
slither-interface Mock tests/tools/interface/ContractMock.sol --exclude-structs | ||
DIFF=$(diff crytic-export/interfaces/IMock.sol "$DIR_TESTS/test_4.sol" --strip-trailing-cr) | ||
if [ "$DIFF" != "" ] | ||
then | ||
echo "slither-interface test 4 failed" | ||
cat "crytic-export/interfaces/IMock.sol" | ||
echo "" | ||
cat "$DIR_TESTS/test_4.sol" | ||
exit 255 | ||
fi | ||
|
||
#Test 5 - exclude errors | ||
slither-interface Mock tests/tools/interface/ContractMock.sol --exclude-errors | ||
DIFF=$(diff crytic-export/interfaces/IMock.sol "$DIR_TESTS/test_5.sol" --strip-trailing-cr) | ||
if [ "$DIFF" != "" ] | ||
then | ||
echo "slither-interface test 5 failed" | ||
cat "crytic-export/interfaces/IMock.sol" | ||
echo "" | ||
cat "$DIR_TESTS/test_5.sol" | ||
exit 255 | ||
fi | ||
|
||
#Test 6 - exclude enums | ||
slither-interface Mock tests/tools/interface/ContractMock.sol --exclude-enums | ||
DIFF=$(diff crytic-export/interfaces/IMock.sol "$DIR_TESTS/test_6.sol" --strip-trailing-cr) | ||
if [ "$DIFF" != "" ] | ||
then | ||
echo "slither-interface test 6 failed" | ||
cat "crytic-export/interfaces/IMock.sol" | ||
echo "" | ||
cat "$DIR_TESTS/test_6.sol" | ||
exit 255 | ||
fi | ||
|
||
#Test 7 - exclude events | ||
slither-interface Mock tests/tools/interface/ContractMock.sol --exclude-events | ||
DIFF=$(diff crytic-export/interfaces/IMock.sol "$DIR_TESTS/test_7.sol" --strip-trailing-cr) | ||
if [ "$DIFF" != "" ] | ||
then | ||
echo "slither-interface test 7 failed" | ||
cat "crytic-export/interfaces/IMock.sol" | ||
echo "" | ||
cat "$DIR_TESTS/test_7.sol" | ||
exit 255 | ||
fi | ||
|
||
rm -r crytic-export |
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
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
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,32 +1,23 @@ | ||
from typing import Union, TYPE_CHECKING | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
from slither.core.expressions.expression import Expression | ||
from slither.core.solidity_types.type import Type | ||
|
||
if TYPE_CHECKING: | ||
from slither.core.solidity_types.elementary_type import ElementaryType | ||
from slither.core.solidity_types.type_alias import TypeAliasTopLevel | ||
from slither.core.solidity_types.array_type import ArrayType | ||
|
||
|
||
class NewArray(Expression): | ||
|
||
# note: dont conserve the size of the array if provided | ||
def __init__( | ||
self, depth: int, array_type: Union["TypeAliasTopLevel", "ElementaryType"] | ||
) -> None: | ||
def __init__(self, array_type: "ArrayType") -> None: | ||
super().__init__() | ||
assert isinstance(array_type, Type) | ||
self._depth: int = depth | ||
self._array_type: Type = array_type | ||
# pylint: disable=import-outside-toplevel | ||
from slither.core.solidity_types.array_type import ArrayType | ||
|
||
@property | ||
def array_type(self) -> Type: | ||
return self._array_type | ||
assert isinstance(array_type, ArrayType) | ||
self._array_type = array_type | ||
|
||
@property | ||
def depth(self) -> int: | ||
return self._depth | ||
def array_type(self) -> "ArrayType": | ||
return self._array_type | ||
|
||
def __str__(self): | ||
return "new " + str(self._array_type) + "[]" * self._depth | ||
return "new " + str(self._array_type) |
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
Oops, something went wrong.