Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
merendamattia committed Nov 4, 2024
1 parent a79de48 commit 8cb3c6e
Show file tree
Hide file tree
Showing 53 changed files with 26 additions and 1,510 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ evm-testcases/ground-truth/test/statistics.csv
script-python/journal/reentrancy/results/
script-python/journal/reentrancy/json/
script-python/journal/execution/
script-python/journal/vanilla/results/
script-python/journal/vanilla/json/

# Ignore downloaded bytecode
evm-testcases/benchmark/
Expand Down
29 changes: 19 additions & 10 deletions script-python/journal/compile-all.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def extract_and_save_longest_bytecode(bytecode_dir, json_dir):
longest_bytecode = longest_bytecode[second_index:]

bytecode_file.write("0x" + longest_bytecode)
# print(f"Extracted longest bytecode from {longest_contract_name} to {bytecode_filename}")
print(f"Extracted longest bytecode from {longest_contract_name} to {bytecode_filename}")

def extract_and_save_bytecode(bytecode_dir, json_dir):
"""
Expand All @@ -108,6 +108,14 @@ def extract_and_save_bytecode(bytecode_dir, json_dir):
bytecode_dir, f"{os.path.splitext(json_filename)[0]}_{count}.bytecode"
)
with open(bytecode_filename, 'w') as bytecode_file:
# Find the first occurrence of '60406040'
first_index = bytecode.find('60806040')

# Find the second occurrence of '60406040' after the first
second_index = bytecode.find('60806040', first_index + len('60806040'))

bytecode = bytecode[second_index:]

bytecode_file.write("0x" + bytecode)
print(f"Extracted bytecode to {bytecode_filename}")
count += 1 # Increment counter for next bytecode
Expand All @@ -116,15 +124,16 @@ def extract_and_save_bytecode(bytecode_dir, json_dir):

compile_solidity_sources('./reentrancy/source-code',
'./reentrancy/json')
# extract_and_save_bytecode('./reentrancy/bytecode',
# './reentrancy/json')
extract_and_save_longest_bytecode('./reentrancy/bytecode',
'./reentrancy/json')


compile_solidity_sources('./vanilla/source-code',
'./vanilla/json')
# extract_and_save_bytecode('./vanilla/bytecode',
# './vanilla/json')
"""
extract_and_save_bytecode('./reentrancy/bytecode',
'./reentrancy/json')
extract_and_save_bytecode('./vanilla/bytecode',
'./vanilla/json')
"""

extract_and_save_longest_bytecode('./vanilla/bytecode',
'./vanilla/json')
'./vanilla/json')
extract_and_save_longest_bytecode('./reentrancy/bytecode',
'./reentrancy/json')
5 changes: 5 additions & 0 deletions script-python/journal/run-benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ def results_evmlisa(directory_path, print_data):
if match:
id = int(match.group(1))
results[id] += result

match = re.match(r'(\d+)_(\d+)-\w+\.json', file)
if match:
id = int(match.group(1))
results[id] += result

sorted_data = dict(sorted(results.items()))

Expand Down
30 changes: 0 additions & 30 deletions script-python/journal/vanilla/results/evmlisa/1-result.json

This file was deleted.

30 changes: 0 additions & 30 deletions script-python/journal/vanilla/results/evmlisa/10-result.json

This file was deleted.

Loading

0 comments on commit 8cb3c6e

Please sign in to comment.