-
Notifications
You must be signed in to change notification settings - Fork 261
Expand file tree
/
Copy pathtest-solc-compatibility.sh
More file actions
executable file
·42 lines (34 loc) · 1.58 KB
/
test-solc-compatibility.sh
File metadata and controls
executable file
·42 lines (34 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
# NOTE: This utility checks the solc-0.8.11 compatibility of all the interface contracts we export
# make sure that if any step fails, the script fails
set -xe
cd "$(dirname "$0")"/..
# Download solc if needed and verify its checksum
SOLC=solc-0.8.11
if ! which $SOLC; then
[ -n "$CI" ] && echo "Refusing to download solc in CI environment" && exit 1
# This process assuming ubuntu Linux.
[ -z "$(apt list --installed | grep coreutils)" ] && apt-get install coreutils
mkdir -p ./build/bin
SOLC=build/bin/solc-0.8.11
if [ ! -f "$SOLC" ]; then
wget https://github.com/ethereum/solc-bin/raw/gh-pages/linux-amd64/solc-linux-amd64-v0.8.11%2Bcommit.d7f03943 -O $SOLC
chmod +x ./$SOLC
fi
CHKSUM=$(sha256sum ./$SOLC | awk '{print $1}')
EXPECTED_CHKSUM="717c239f3a1dc3a4834c16046a0b4b9f46964665c8ffa82051a6d09fe741cd4f"
[ "$CHKSUM" == "$EXPECTED_CHKSUM" ]
fi
# https://github.com/ethereum/solc-bin/blob/gh-pages/linux-amd64/list.json
# 0x64016310a57caf1af76a3610f1f94c8848c04c9673e7fa268492e608918a4bdc
# TODO: get json file, find builds with path: solc-linux-amd64-v0.8.4%2Bcommit.c7e474f2
# compare sha256 we generate with the downloaded bin file above with the sha256 obtained
# from here - don't forget to add 0x to our generated sha256
# workaround to make solc to find OZ library
ln -s ../../lib/openzeppelin-contracts @openzeppelin-v5
# verify they are compatible with the minimum version of the SOLC we support
find contracts/{interfaces/,apps/} -name '*.sol' | while read i;do
$SOLC --allow-paths '@openzeppelin-v5' $i
done
echo SUCCESS
rm -f @openzeppelin-v5