Skip to content

Commit 4cf084d

Browse files
committed
Merge branch 'dev'
2 parents 01800ef + 76c5cb2 commit 4cf084d

File tree

6,359 files changed

+157156
-25680
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

6,359 files changed

+157156
-25680
lines changed

.github/workflows/parser.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,11 @@ jobs:
3535
3636
git clone https://github.com/crytic/solc-select.git
3737
cd solc-select
38-
git checkout 857d6fa883d9283454be1cb2d869a8f9962b27b8
38+
git checkout 119dd05f58341811cb02b546f25269a7e8a10875
39+
python setup.py install
40+
solc-select install all
41+
solc-select use 0.8.0
3942
cd ..
40-
./solc-select/scripts/install.sh
41-
export PATH=/home/runner/.solc-select:$PATH
42-
echo "export PATH=/home/runner/.solc-select:$PATH" >> ~/.bashrc
43-
solc use 0.7.3
4443
4544
- name: Test with pytest
4645
run: |

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ To see the tests coverage, run `pytest tests/test_detectors.py --cov=slither/d
5151

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

examples/scripts/convert_to_ir.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
slither = Slither(sys.argv[1])
1212

1313
# Get the contract
14-
contract = slither.get_contract_from_name("Test")
15-
assert contract
14+
contracts = slither.get_contract_from_name("Test")
15+
assert len(contracts) == 1
16+
contract = contracts[0]
1617
# Get the variable
1718
test = contract.get_function_from_signature("one()")
1819
assert test

examples/scripts/data_dependency.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313

1414
slither = Slither(sys.argv[1])
1515

16-
contract = slither.get_contract_from_name("Simple")
17-
assert contract
16+
contracts = slither.get_contract_from_name("Simple")
17+
assert len(contracts) == 1
18+
contract = contracts[0]
1819
destination = contract.get_state_variable_from_name("destination")
1920
source = contract.get_state_variable_from_name("source")
2021

@@ -35,8 +36,9 @@
3536
print("{} is tainted {}".format(destination, is_tainted(destination, contract)))
3637
assert is_tainted(destination, contract)
3738

38-
contract = slither.get_contract_from_name("Reference")
39-
assert contract
39+
contracts = slither.get_contract_from_name("Reference")
40+
assert len(contracts) == 1
41+
contract = contracts[0]
4042
destination = contract.get_state_variable_from_name("destination")
4143
assert destination
4244
source = contract.get_state_variable_from_name("source")
@@ -73,8 +75,9 @@
7375

7476
print("SolidityVar contract")
7577

76-
contract = slither.get_contract_from_name("SolidityVar")
77-
assert contract
78+
contracts = slither.get_contract_from_name("SolidityVar")
79+
assert len(contracts) == 1
80+
contract = contracts[0]
7881
addr_1 = contract.get_state_variable_from_name("addr_1")
7982
assert addr_1
8083
addr_2 = contract.get_state_variable_from_name("addr_2")
@@ -91,8 +94,9 @@
9194

9295

9396
print("Intermediate contract")
94-
contract = slither.get_contract_from_name("Intermediate")
95-
assert contract
97+
contracts = slither.get_contract_from_name("Intermediate")
98+
assert len(contracts) == 1
99+
contract = contracts[0]
96100
destination = contract.get_state_variable_from_name("destination")
97101
assert destination
98102
source = contract.get_state_variable_from_name("source")
@@ -106,8 +110,10 @@
106110
assert is_dependent(destination, source, contract)
107111

108112
print("Base Derived contract")
109-
contract = slither.get_contract_from_name("Base")
110-
contract_derived = slither.get_contract_from_name("Derived")
113+
contracts = slither.get_contract_from_name("Base")
114+
assert len(contracts) == 1
115+
contract = contracts[0]
116+
contract_derived = slither.get_contract_from_name("Derived")[0]
111117
destination = contract.get_state_variable_from_name("destination")
112118
source = contract.get_state_variable_from_name("source")
113119

@@ -125,8 +131,9 @@
125131
assert is_dependent(destination, source, contract_derived)
126132

127133
print("PropagateThroughArguments contract")
128-
contract = slither.get_contract_from_name("PropagateThroughArguments")
129-
assert contract
134+
contracts = slither.get_contract_from_name("PropagateThroughArguments")
135+
assert len(contracts) == 1
136+
contract = contracts[0]
130137
var_tainted = contract.get_state_variable_from_name("var_tainted")
131138
assert var_tainted
132139
var_not_tainted = contract.get_state_variable_from_name("var_not_tainted")

examples/scripts/functions_called.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
slither = Slither(sys.argv[1])
1010

1111
# Get the contract
12-
contract = slither.get_contract_from_name("Contract")
13-
assert contract
12+
contracts = slither.get_contract_from_name("Contract")
13+
assert len(contracts) == 1
14+
contract = contracts[0]
1415

1516
# Get the variable
1617
entry_point = contract.get_function_from_signature("entry_point()")

examples/scripts/functions_writing.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
slither = Slither(sys.argv[1])
1010

1111
# Get the contract
12-
contract = slither.get_contract_from_name("Contract")
13-
12+
contracts = slither.get_contract_from_name("Contract")
13+
assert len(contracts) == 1
14+
contract = contracts[0]
1415
# Get the variable
1516
var_a = contract.get_state_variable_from_name("a")
1617

examples/scripts/possible_paths.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ def resolve_function(contract_name, function_name):
1111
:return: Returns the resolved function, raises an exception otherwise.
1212
"""
1313
# Obtain the target contract
14-
contract = slither.get_contract_from_name(contract_name)
14+
contracts = slither.get_contract_from_name(contract_name)
1515

1616
# Verify the contract was resolved successfully
17-
if contract is None:
17+
if len(contracts) != 1:
1818
raise ValueError(f"Could not resolve target contract: {contract_name}")
19-
19+
contract = contracts[0]
2020
# Obtain the target function
2121
target_function = next(
2222
(function for function in contract.functions if function.name == function_name), None

examples/scripts/taint_mapping.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def visit_node(node, visited):
1414
return
1515

1616
visited += [node]
17-
taints = node.function.slither.context[KEY]
17+
taints = node.function.compilation_unit.context[KEY]
1818

1919
refs = {}
2020
for ir in node.irs:
@@ -41,7 +41,7 @@ def visit_node(node, visited):
4141

4242
taints = [v for v in taints if not isinstance(v, (TemporaryVariable, ReferenceVariable))]
4343

44-
node.function.slither.context[KEY] = list(set(taints))
44+
node.function.compilation_unit.context[KEY] = list(set(taints))
4545

4646
for son in node.sons:
4747
visit_node(son, visited)

examples/scripts/variable_in_condition.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
slither = Slither(sys.argv[1])
1010

1111
# Get the contract
12-
contract = slither.get_contract_from_name("Contract")
13-
12+
contracts = slither.get_contract_from_name("Contract")
13+
assert len(contracts) == 1
14+
contract = contracts[0]
1415
# Get the variable
1516
var_a = contract.get_state_variable_from_name("a")
1617

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
install_requires=[
1212
"prettytable>=0.7.2",
1313
"pysha3>=1.0.2",
14-
"crytic-compile>=0.1.13",
15-
# "crytic-compile",
14+
# "crytic-compile>=0.1.13",
15+
"crytic-compile",
1616
],
17-
# dependency_links=["git+https://github.com/crytic/crytic-compile.git@master#egg=crytic-compile"],
17+
dependency_links=["git+https://github.com/crytic/crytic-compile.git@master#egg=crytic-compile"],
1818
license="AGPL-3.0",
1919
long_description=open("README.md").read(),
2020
entry_points={

0 commit comments

Comments
 (0)