2023-06-19 12:46:53 +00:00
|
|
|
#!/usr/bin/env bash
|
2023-01-30 09:32:30 +00:00
|
|
|
set -e
|
2023-01-30 13:35:14 +00:00
|
|
|
|
2023-01-30 16:44:34 +00:00
|
|
|
root=$(cd $(dirname "$0")/.. && pwd)
|
2023-06-19 09:36:21 +00:00
|
|
|
arch=$(arch)
|
2023-01-30 16:44:34 +00:00
|
|
|
|
2023-05-30 13:38:08 +00:00
|
|
|
if command -v echidna; then
|
2023-01-30 13:35:14 +00:00
|
|
|
fuzz () {
|
2023-05-30 13:38:08 +00:00
|
|
|
echidna ${root} \
|
2023-01-30 16:44:34 +00:00
|
|
|
--config ${root}/fuzzing/echidna.yaml \
|
|
|
|
--corpus-dir ${root}/fuzzing/corpus \
|
2023-02-28 15:32:47 +00:00
|
|
|
--crytic-args --ignore-compile \
|
2023-01-30 13:35:14 +00:00
|
|
|
--contract $1
|
|
|
|
}
|
2023-06-19 09:36:21 +00:00
|
|
|
elif [ "${arch}" = "x86_64" ]; then
|
2023-01-30 13:35:14 +00:00
|
|
|
fuzz () {
|
|
|
|
docker run \
|
|
|
|
--rm \
|
2023-01-30 16:44:34 +00:00
|
|
|
-v ${root}:/src ghcr.io/crytic/echidna/echidna \
|
2023-01-30 13:35:14 +00:00
|
|
|
bash -c \
|
2023-05-30 13:38:08 +00:00
|
|
|
"cd /src && echidna . \
|
2023-01-30 13:35:14 +00:00
|
|
|
--config fuzzing/echidna.yaml \
|
2023-01-30 16:44:34 +00:00
|
|
|
--corpus-dir fuzzing/corpus \
|
2023-01-30 13:35:14 +00:00
|
|
|
--crytic-args --ignore-compile \
|
|
|
|
--contract $1"
|
|
|
|
}
|
2023-06-19 09:36:21 +00:00
|
|
|
else
|
|
|
|
echo "Error: echidna not found, and the docker image does not support ${arch}"
|
|
|
|
echo "Please install echidna: https://github.com/crytic/echidna#installation"
|
|
|
|
exit 1
|
2023-01-30 13:35:14 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
fuzz FuzzMarketplace
|