Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Commit

Permalink
fix: update oyente to support new version of CryticCompile
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Oct 21, 2021
1 parent 5013bec commit 480e725
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ COPY --from=geth /usr/local/bin/evm /usr/local/bin/evm
# Install solc from official solc image
COPY --from=solc /usr/bin/solc /usr/bin/solc

RUN pip3 install crytic-compile
RUN pip3 install crytic-compile six

COPY . /oyente/

Expand Down
14 changes: 10 additions & 4 deletions oyente/input_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,25 @@ def _get_compiled_contracts(self):
return self.compiled_contracts

def _extract_bin_obj(self, com: CryticCompile):
return [(com.contracts_filenames[name].absolute + ':' + name, com.bytecode_runtime(name)) for name in com.contracts_names if com.bytecode_runtime(name)]
output = []
for file in com.compilation_units:
output.extend([(com.compilation_units[file].contracts_filenames[name].absolute + ':' + name, com.compilation_units[file].bytecode_runtime(name)) for name in com.compilation_units[file].contracts_names if com.compilation_units[file].bytecode_runtime(name)])
return output

def _compile_solidity(self):
try:
options = []
if self.allow_paths:
options.append(F"--allow-paths {self.allow_paths}")

com = CryticCompile(self.source, solc_remaps=self.remap, solc_args=' '.join(options))
contracts = self._extract_bin_obj(com)

libs = com.contracts_names.difference(com.contracts_names_without_libraries)
if libs:
libs = set()
for file in com.compilation_units:
tmp_lib = com.compilation_units[file].contracts_names.difference(com.compilation_units[file].contracts_names_without_libraries)
if tmp_lib:
libs = libs.union(tmp_lib)
if len(libs) > 0:
return self._link_libraries(self.source, libs)

return contracts
Expand Down

0 comments on commit 480e725

Please sign in to comment.