Skip to content

Commit 4b647a7

Browse files
Merge pull request #32 from lisa-analyzer/reachability-cache
Optimized DFS, ReentrancyChecker, Dockerfile, tests
2 parents 7316ae4 + 7ccdd12 commit 4b647a7

File tree

1,978 files changed

+577
-1568
lines changed

Some content is hidden

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

1,978 files changed

+577
-1568
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
scripts/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ scripts/python/benchmark-checkers/**/abi/**
2020
scripts/python/benchmark-checkers/**/json/**
2121
scripts/python/benchmark-checkers/**/results/**
2222
scripts/python/benchmark-checkers/images/**
23+
scripts/python/benchmark-checkers/jars/evm-lisa.jar
2324

2425
# Ignore downloaded bytecode
2526
evm-testcases/benchmark/

Dockerfile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
FROM openjdk:11-jdk-slim
33

44
# Specify the version of Gradle to install
5-
ARG GRADLE_VERSION=6.6
5+
ARG GRADLE_VERSION=8.0
66

77
# Install Gradle
88
RUN apt-get update && apt-get install -y wget unzip git && \
@@ -23,14 +23,10 @@ WORKDIR /app
2323
COPY . .
2424

2525
# Build the project with Gradle
26-
RUN gradle build
27-
28-
# Extract the project ZIP file for distribution
29-
RUN gradle distZip && \
30-
unzip -o build/distributions/evm-lisa.zip -d /app/execution
26+
RUN gradle assemble
3127

3228
# Create results directory
3329
RUN mkdir -p /app/execution/results
3430

3531
# Set the entry point of the container
36-
ENTRYPOINT ["/app/execution/evm-lisa/bin/evm-lisa"]
32+
ENTRYPOINT ["java", "-jar", "/app/build/libs/evm-lisa-all.jar"]

README.md

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ EVMLiSA is based on the peer-reviewed publication
1414
1515
# 🛠 Building EVMLiSA
1616
Compiling EVMLiSA requires:
17-
- JDK >= 11
18-
- [Gradle](https://gradle.org/releases/) >= 6.6
17+
- JDK >= 11 (optional using Docker)
18+
- [Gradle](https://gradle.org/releases/) >= 8.0 (optional using Docker)
1919
- [Etherscan API key](https://etherscan.io/myapikey)
2020

2121
You need to:
@@ -53,53 +53,37 @@ docker run --rm -it \
5353
-v $(pwd)/.env:/app/.env \
5454
-v $(pwd)/execution/docker:/app/execution/results \
5555
evm-lisa:latest \
56-
-a <smart_contract_address> [options]
56+
[options]
5757
```
5858

5959
- `-v $(pwd)/.env:/app/.env`: mount the `.env` file.
6060
- `-v $(pwd)/execution/docker:/app/execution/results`: share the results' folder.
6161

62-
> Replace `<smart_contract_address>` with the address of the Ethereum smart contract you want to analyze.
63-
6462
## Via Bash
6563
Build the Project:
6664
```bash
67-
./gradlew build
68-
```
69-
70-
Create Distribution Zip:
71-
```bash
72-
./gradlew distZip
73-
```
74-
75-
Unzip the Distribution:
76-
```bash
77-
unzip build/distributions/evm-lisa.zip -d execution
65+
./gradlew assemble
7866
```
7967

8068
Then you can run EVMLiSA with:
8169
```bash
82-
./execution/evm-lisa/bin/evm-lisa \
83-
-a <smart_contract_address> [options]
70+
java -jar build/libs/evm-lisa-all.jar [options]
8471
```
85-
> Replace `<smart_contract_address>` with the address of the Ethereum smart contract you want to analyze.
86-
87-
This command will initiate the analysis process for the specified smart contract, providing insights and results based on the EVM bytecode of the contract.
8872

8973
```
9074
Options:
9175
-a,--address <arg> Address of an Ethereum smart contract.
9276
-b,--benchmark <arg> Filepath of the benchmark.
9377
-c,--cores <arg> Number of cores used in benchmark.
9478
--checker-reentrancy Enable re-entrancy checker.
79+
--checker-timestampdependency Enable timestamp-dependency checker.
9580
--checker-txorigin Enable tx-origin checker.
9681
--creation-code Parse bytecode as creation code (instead of runtime code).
9782
--dot Export a dot-notation file.
9883
--download-bytecode Download the bytecode.
9984
--dump-report Dump analysis report.
10085
--dump-stats Dump statistics.
10186
-f,--filepath-bytecode <arg> Filepath of the bytecode file.
102-
--filepath-mnemonic <arg> Filepath of the mnemonic file.
10387
--html Export a graphic HTML report.
10488
--link-unsound-jumps-to-all-jumpdest Link all the unsound jumps to all jumpdest.
10589
-o,--output <arg> Output directory path.
@@ -119,12 +103,12 @@ Here is an example of how to run EVMLiSA. In this example, we will analyze a sma
119103

120104
- Bash:
121105
```bash
122-
./execution/evm-lisa/bin/evm-lisa \
106+
java -jar build/libs/evm-lisa-all.jar \
123107
-a 0x7c21C4Bbd63D05Fa9F788e38d14e18FC52E9557B \
124108
--stack-size 64 \
125109
--stack-set-size 10 \
126-
--dump-stats \
127-
--use-live-storage
110+
--creation-code \
111+
--link-unsound-jumps-to-all-jumpdest
128112
```
129113

130114
- Docker:
@@ -136,8 +120,8 @@ evm-lisa:latest \
136120
-a 0x7c21C4Bbd63D05Fa9F788e38d14e18FC52E9557B \
137121
--stack-size 64 \
138122
--stack-set-size 10 \
139-
--dump-stats \
140-
--use-live-storage
123+
--creation-code \
124+
--link-unsound-jumps-to-all-jumpdest
141125
```
142126

143127
> Use `docker run -a stderr` to dump only the json report as standard output.

evm-testcases/cfs/if_else_npbj/report.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
"files" : [ "report.json", "untyped_program.evm-testcases_cfs_if_else_npbj_if_else_npbj_eth.sol().json" ],
44
"info" : {
55
"cfgs" : "1",
6-
"duration" : "7ms",
7-
"end" : "2024-10-03T17:31:51.790+02:00",
6+
"duration" : "344ms",
7+
"end" : "2025-02-19T15:16:09.128+01:00",
88
"expressions" : "9",
99
"files" : "1",
1010
"globals" : "0",
1111
"members" : "1",
1212
"programs" : "1",
13-
"start" : "2024-10-03T17:31:51.783+02:00",
13+
"start" : "2025-02-19T15:16:08.784+01:00",
1414
"statements" : "17",
1515
"units" : "0",
16-
"version" : "0.1b8",
16+
"version" : "0.1",
1717
"warnings" : "0"
1818
},
1919
"configuration" : {

evm-testcases/cfs/if_else_npbj/untyped_program.evm-testcases_cfs_if_else_npbj_if_else_npbj_eth.sol().json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

scripts/python/benchmark-checkers/compile-smart-contracts.py

Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -380,114 +380,114 @@ def compile_bridge(name):
380380
abi_dir='./cross-chain/THORChain-bridge/abi/')
381381

382382
if args.solidifi:
383-
compile_solidity_sources('./reentrancy-solidifi/source-code',
384-
'./reentrancy-solidifi/json')
385-
compile_solidity_sources('./vanilla-solidifi/source-code',
386-
'./vanilla-solidifi/json')
387-
compile_solidity_sources('./tx-origin-solidifi/source-code',
388-
'./tx-origin-solidifi/json')
389-
compile_solidity_sources('./timestamp-dependency-solidifi/source-code',
390-
'./timestamp-dependency-solidifi/json')
383+
compile_solidity_sources('./solidifi/reentrancy/source-code',
384+
'./solidifi/reentrancy/json')
385+
compile_solidity_sources('./solidifi/vanilla/source-code',
386+
'./solidifi/vanilla/json')
387+
compile_solidity_sources('./solidifi/tx-origin/source-code',
388+
'./solidifi/tx-origin/json')
389+
compile_solidity_sources('./solidifi/timestamp-dependency/source-code',
390+
'./solidifi/timestamp-dependency/json')
391391

392392
if args.longest_bytecode:
393393
# EVMLiSA
394-
extract_and_save_longest_bytecode('./vanilla-solidifi/bytecode/evmlisa',
395-
'./vanilla-solidifi/json',
396-
abi_dir='./vanilla-solidifi/abi/evmlisa')
397-
extract_and_save_longest_bytecode('./reentrancy-solidifi/bytecode/evmlisa',
398-
'./reentrancy-solidifi/json',
399-
abi_dir='./reentrancy-solidifi/abi/evmlisa')
394+
extract_and_save_longest_bytecode('./solidifi/vanilla/bytecode/evmlisa',
395+
'./solidifi/vanilla/json',
396+
abi_dir='./solidifi/vanilla/abi/evmlisa')
397+
extract_and_save_longest_bytecode('./solidifi/reentrancy/bytecode/evmlisa',
398+
'./solidifi/reentrancy/json',
399+
abi_dir='./solidifi/reentrancy/abi/evmlisa')
400400
# TX-ORIGIN
401-
extract_and_save_longest_bytecode('./tx-origin-solidifi/bytecode/evmlisa',
402-
'./tx-origin-solidifi/json')
401+
extract_and_save_longest_bytecode('./solidifi/tx-origin/bytecode/evmlisa',
402+
'./solidifi/tx-origin/json')
403403

404404
# Timestamp-dependency
405-
extract_and_save_longest_bytecode('./timestamp-dependency-solidifi/bytecode/evmlisa',
406-
'./timestamp-dependency-solidifi/json')
405+
extract_and_save_longest_bytecode('./solidifi/timestamp-dependency/bytecode/evmlisa',
406+
'./solidifi/timestamp-dependency/json')
407407

408408
# EtherSolve
409-
extract_and_save_longest_bytecode('./vanilla-solidifi/bytecode/ethersolve',
410-
'./vanilla-solidifi/json',
409+
extract_and_save_longest_bytecode('./solidifi/vanilla/bytecode/ethersolve',
410+
'./solidifi/vanilla/json',
411411
True)
412-
extract_and_save_longest_bytecode('./reentrancy-solidifi/bytecode/ethersolve',
413-
'./reentrancy-solidifi/json',
412+
extract_and_save_longest_bytecode('./solidifi/reentrancy/bytecode/ethersolve',
413+
'./solidifi/reentrancy/json',
414414
True)
415415
else:
416416
# EVMLiSA
417-
extract_and_save_bytecode('./vanilla-solidifi/bytecode/evmlisa',
418-
'./vanilla-solidifi/json')
419-
extract_and_save_bytecode('./reentrancy-solidifi/bytecode/evmlisa',
420-
'./reentrancy-solidifi/json')
417+
extract_and_save_bytecode('./solidifi/vanilla/bytecode/evmlisa',
418+
'./solidifi/vanilla/json')
419+
extract_and_save_bytecode('./solidifi/reentrancy/bytecode/evmlisa',
420+
'./solidifi/reentrancy/json')
421421
# TX-ORIGIN
422-
extract_and_save_bytecode('./tx-origin-solidifi/bytecode/evmlisa',
423-
'./tx-origin-solidifi/json')
422+
extract_and_save_bytecode('./solidifi/tx-origin/bytecode/evmlisa',
423+
'./solidifi/tx-origin/json')
424424

425425
# Timestamp-dependency
426-
extract_and_save_bytecode('./timestamp-dependency-solidifi/bytecode/evmlisa',
427-
'./timestamp-dependency-solidifi/json')
426+
extract_and_save_bytecode('./solidifi/timestamp-dependency/bytecode/evmlisa',
427+
'./solidifi/timestamp-dependency/json')
428428

429429
# EtherSolve
430-
extract_and_save_bytecode('./vanilla-solidifi/bytecode/ethersolve',
431-
'./vanilla-solidifi/json',
430+
extract_and_save_bytecode('./solidifi/vanilla/bytecode/ethersolve',
431+
'./solidifi/vanilla/json',
432432
True)
433-
extract_and_save_bytecode('./reentrancy-solidifi/bytecode/ethersolve',
434-
'./reentrancy-solidifi/json',
433+
extract_and_save_bytecode('./solidifi/reentrancy/bytecode/ethersolve',
434+
'./solidifi/reentrancy/json',
435435
True)
436436

437437
if args.smartbugs:
438-
compile_solidity_sources_with_different_version('./reentrancy-smartbugs/source-code',
439-
'./reentrancy-smartbugs/json',
440-
'./reentrancy-smartbugs/source-code/version.csv')
438+
compile_solidity_sources_with_different_version('./smartbugs/reentrancy/source-code',
439+
'./smartbugs/reentrancy/json',
440+
'./smartbugs/reentrancy/source-code/version.csv')
441441

442-
compile_solidity_sources_with_different_version('./timestamp-dependency-smartbugs/source-code',
443-
'./timestamp-dependency-smartbugs/json',
444-
'./timestamp-dependency-smartbugs/source-code/version.csv')
442+
compile_solidity_sources_with_different_version('./smartbugs/timestamp-dependency/source-code',
443+
'./smartbugs/timestamp-dependency/json',
444+
'./smartbugs/timestamp-dependency/source-code/version.csv')
445445

446446
if args.longest_bytecode:
447-
extract_and_save_longest_bytecode('./reentrancy-smartbugs/bytecode/evmlisa',
448-
'./reentrancy-smartbugs/json')
449-
extract_and_save_longest_bytecode('./timestamp-dependency-smartbugs/bytecode/evmlisa',
450-
'./timestamp-dependency-smartbugs/json')
451-
extract_and_save_longest_bytecode('./reentrancy-smartbugs/bytecode/ethersolve',
452-
'./reentrancy-smartbugs/json',
447+
extract_and_save_longest_bytecode('./smartbugs/reentrancy/bytecode/evmlisa',
448+
'./smartbugs/reentrancy/json')
449+
extract_and_save_longest_bytecode('./smartbugs/timestamp-dependency/bytecode/evmlisa',
450+
'./smartbugs/timestamp-dependency/json')
451+
extract_and_save_longest_bytecode('./smartbugs/reentrancy/bytecode/ethersolve',
452+
'./smartbugs/reentrancy/json',
453453
True)
454454
else:
455-
extract_and_save_bytecode('./reentrancy-smartbugs/bytecode/evmlisa',
456-
'./reentrancy-smartbugs/json')
457-
extract_and_save_bytecode('./timestamp-dependency-smartbugs/bytecode/evmlisa',
458-
'./timestamp-dependency-smartbugs/json')
459-
extract_and_save_bytecode('./reentrancy-smartbugs/bytecode/ethersolve',
460-
'./reentrancy-smartbugs/json',
455+
extract_and_save_bytecode('./smartbugs/reentrancy/bytecode/evmlisa',
456+
'./smartbugs/reentrancy/json')
457+
extract_and_save_bytecode('./smartbugs/timestamp-dependency/bytecode/evmlisa',
458+
'./smartbugs/timestamp-dependency/json')
459+
extract_and_save_bytecode('./smartbugs/reentrancy/bytecode/ethersolve',
460+
'./smartbugs/reentrancy/json',
461461
True)
462462

463463
if args.slise:
464-
extract_solidity_versions('./reentrancy-slise-db1/source-code',
465-
'./reentrancy-slise-db1/source-code/version.csv')
466-
generate_file_index('./reentrancy-slise-db1/source-code',
467-
'./reentrancy-slise-db1/match-file-index.json')
468-
compile_solidity_sources_with_different_version('./reentrancy-slise-db1/source-code',
469-
'./reentrancy-slise-db1/json',
470-
'./reentrancy-slise-db1/source-code/version.csv')
464+
extract_solidity_versions('./slise/reentrancy-db1/source-code',
465+
'./slise/reentrancy-db1/source-code/version.csv')
466+
generate_file_index('./slise/reentrancy-db1/source-code',
467+
'./slise/reentrancy-db1/match-file-index.json')
468+
compile_solidity_sources_with_different_version('./slise/reentrancy-db1/source-code',
469+
'./slise/reentrancy-db1/json',
470+
'./slise/reentrancy-db1/source-code/version.csv')
471471

472-
with open('./reentrancy-slise-db1/match-file-index.json', 'r') as index_file:
472+
with open('./slise/reentrancy-db1/match-file-index.json', 'r') as index_file:
473473
match_file_index = json.load(index_file)
474474

475475
if args.longest_bytecode:
476-
extract_and_save_longest_bytecode('./reentrancy-slise-db1/bytecode/evmlisa',
477-
'./reentrancy-slise-db1/json',
476+
extract_and_save_longest_bytecode('./slise/reentrancy-db1/bytecode/evmlisa',
477+
'./slise/reentrancy-db1/json',
478478
False,
479479
match_file_index)
480-
extract_and_save_longest_bytecode('./reentrancy-slise-db1/bytecode/ethersolve',
481-
'./reentrancy-slise-db1/json',
480+
extract_and_save_longest_bytecode('./slise/reentrancy-db1/bytecode/ethersolve',
481+
'./slise/reentrancy-db1/json',
482482
True,
483483
match_file_index)
484484
else:
485485

486-
extract_and_save_bytecode('./reentrancy-slise-db1/bytecode/evmlisa',
487-
'./reentrancy-slise-db1/json',
486+
extract_and_save_bytecode('./slise/reentrancy-db1/bytecode/evmlisa',
487+
'./slise/reentrancy-db1/json',
488488
False,
489489
match_file_index)
490-
extract_and_save_bytecode('./reentrancy-slise-db1/bytecode/ethersolve',
491-
'./reentrancy-slise-db1/json',
490+
extract_and_save_bytecode('./slise/reentrancy-db1/bytecode/ethersolve',
491+
'./slise/reentrancy-db1/json',
492492
True,
493493
match_file_index)

scripts/python/benchmark-checkers/EtherSolve/EtherSolve.jar renamed to scripts/python/benchmark-checkers/jars/EtherSolve.jar

File renamed without changes.

0 commit comments

Comments
 (0)