Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option for using creation code (#24) and some optimizations #25

Merged
merged 2 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,21 @@ This command will initiate the analysis process for the specified smart contract

```
Options:
-a,--address <arg> address of an Ethereum smart contract
-b,--benchmark <arg> filepath of the benchmark suite (i.e., a list of smart contract addresses)
-C,--cores <arg> number of cores to use
-c,--dump-cfg dump the CFG
-d,--dump-analysis <arg> dump the analysis (html, dot)
-D,--download-bytecode download the bytecode, without analyzing it
-f,--filepath <arg> filepath of an EVM bytecode smart contract
-o,--output <arg> output directory path
-q,--stack-size <arg> maximal height of stack
-s,--dump-stats dump statistics
-S,--use-live-storage use the live storage in SLOAD
-w,--stack-set-size <arg> maximal size of stack sets
-a,--address <arg> Address of an Ethereum smart contract.
-b,--benchmark <arg> Filepath of the benchmark suite (i.e., a list of smart contract addresses).
-c,--cores <arg> Number of cores used in benchmark.
--creation-code Parse bytecode as creation code (instead of runtime code).
--dot Export a dot-notation file.
--download-bytecode Download the bytecode.
--dump-report Dump analysis report.
--dump-stats Dump statistics.
-f,--filepath-bytecode <arg> Filepath of the bytecode file.
--html Export a graphic HTML report.
-o,--output <arg> Output directory path.
--serialize-inputs Serialize inputs.
--stack-set-size <arg> Dimension of stack-set (default: 8).
--stack-size <arg> Dimension of stack (default: 32).
--use-live-storage Use the live storage in SLOAD.
```

# 🔍 Abstract Stack Set Domain
Expand Down
23 changes: 11 additions & 12 deletions script-python/journal/run-benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,15 @@
#################################### Utility
def delete_tmp_files(directory):
"""
Deletes files in the specified directory that contain 'opcodes' in their name.
Deletes files in the specified directory that contain 'no-address' in their name.

Args:
directory (str): The path to the directory from which to delete files.
"""
try:
for filename in os.listdir(directory):
if 'opcodes' in filename:
file_path = os.path.join(directory, filename)
os.remove(file_path)
# print(f"Deleted: {file_path}")
except Exception as e:
print(f"An error occurred: {e}")
command = (
f"rm -rf {directory}/no-address* "
)
subprocess.run(command, shell=True, check=True)

def clean_files(directory_path):
"""
Expand Down Expand Up @@ -122,8 +118,12 @@ def evmlisa():
# print(f"Analysis complete for {result_file}")
analysis_ended += 1
pbar.update(1)

print(f"[EVMLISA] Completed {analysis_ended}/{num_files}.")
delete_tmp_files(bytecode_dir)
delete_tmp_files(results_dir)
delete_tmp_files("./execution/results")
clean_files(result_evmlisa_dir)
print(f"[EVMLISA] File cleaned.")

#################################### EtherSolve

Expand Down Expand Up @@ -223,7 +223,6 @@ def count_sstore_occurrences(directory_path):
ethersolve_thread.join()

print("Finished")
clean_files(result_evmlisa_dir)

# TODO print of results
count_sstore_occurrences(result_ethersolve_dir)
# count_sstore_occurrences(result_ethersolve_dir)
Loading
Loading