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

Allow cairo1BinDir with dockerized plugin #408

Merged
merged 47 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
23fb618
WIP compiler downloader [skip ci]
Nathan-SL Jul 19, 2023
b7b8b5e
Update cairo compiler downloader class
Nathan-SL Jul 21, 2023
d13ba88
Add tests
Nathan-SL Jul 21, 2023
18f978c
Add docs
Nathan-SL Jul 21, 2023
5209bd9
Update stdout writer
Nathan-SL Jul 21, 2023
b98a0df
Remove zip file after extracting [skip ci]
Nathan-SL Jul 21, 2023
893a2b4
Update test
Nathan-SL Jul 21, 2023
aa47556
Update docs [skip ci]
Nathan-SL Jul 21, 2023
b78d9f0
initiate ci
Nathan-SL Jul 21, 2023
4c7b88b
Avoid using slash
Nathan-SL Jul 31, 2023
0db99f9
Make isDirEmpty non-method function
Nathan-SL Jul 31, 2023
e6e1744
Use path.join
Nathan-SL Jul 31, 2023
8d8e33c
Format code
Nathan-SL Jul 31, 2023
81bf0ee
Avoid async Import
Nathan-SL Jul 31, 2023
2f2015c
Get os specific file name
Nathan-SL Jul 31, 2023
a59f5db
Install tar dependency
Nathan-SL Jul 31, 2023
28813b2
Use tar for extracting
Nathan-SL Jul 31, 2023
ff3d749
Validate config.starknet to only contain one of [cairo1BinDir, compil…
Nathan-SL Jul 31, 2023
5efc50a
Update compiler downloader
Nathan-SL Jul 31, 2023
7c47175
Default compiler downloader to home dir
Nathan-SL Aug 1, 2023
e23dd4e
Fix bug with stdoud & stderr
Nathan-SL Aug 1, 2023
b85a014
Use stderr
Nathan-SL Aug 1, 2023
6d5f553
Merge branch 'master' into compiler-downloader
FabijanC Sep 7, 2023
6913d78
Add a couple of TODOs [skip ci]
FabijanC Sep 7, 2023
a329ed4
Refactor; use tar-fs
FabijanC Sep 8, 2023
e1d4b06
Fix cairo version in config.json
FabijanC Sep 11, 2023
62a7c52
Add --single-file where missing in tests
FabijanC Sep 11, 2023
e4d6f1b
Use --add-pythonic-hints flag in cairo1 tests
FabijanC Sep 11, 2023
192404c
Fix compilation
FabijanC Sep 11, 2023
eae1031
Refactor setup-compiler.sh
FabijanC Sep 11, 2023
a11f90d
Fix .gitignore
FabijanC Sep 11, 2023
9766486
Verify binary
FabijanC Sep 11, 2023
72d0b32
Add compiler selection logging [skip ci]
FabijanC Sep 11, 2023
98d6a4f
Fix cairo path bug
FabijanC Sep 11, 2023
3f7fcb6
Remove TODOs from docs [skip ci]
FabijanC Sep 12, 2023
73c873f
Add test
FabijanC Sep 12, 2023
a0d6929
cat BASH_ENV
FabijanC Sep 12, 2023
f6145a6
Restore missing pythonic hints in declareV2 test
FabijanC Sep 12, 2023
9a8e32a
Fix reading CAIRO_COMPILER
FabijanC Sep 12, 2023
53b025d
Read CAIRO_COMPILER from env var
FabijanC Sep 12, 2023
2c228c7
Fix reading CAIRO_COMPILER... again
FabijanC Sep 13, 2023
9b5b4b0
Improve test comments [skip ci]
FabijanC Sep 13, 2023
ad403ca
Fix arch+platform check; refactor
FabijanC Sep 13, 2023
dda95eb
Add failure test
FabijanC Sep 13, 2023
6e2212a
Update docs [skip ci]
FabijanC Sep 13, 2023
2b7ad98
Allow cairo1BinDir with dockerized plugin
FabijanC Sep 13, 2023
039cd19
Merge branch 'master' into allow-cairo1bindir
FabijanC Sep 14, 2023
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
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ commands:
for key in $(jq -r 'keys[]' config.json); do
echo $key=$(jq -r .[\""$key"\"] config.json) >> $BASH_ENV
done
cat $BASH_ENV
- run:
name: "Fetch Devnet version"
command: echo "$STARKNET_DEVNET" > /tmp/devnet-version
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ starknet-hardhat-example-link
cache
.vscode
my-venv
cairo-compiler
cairo/
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"CAIRO_LANG": "0.11.2",
"STARKNET_DEVNET": "0.6.0",
"CAIRO_COMPILER": "v2.1.0",
"CAIRO_COMPILER": "2.1.0",
"SCARB_VERSION": "0.4.0"
}
127 changes: 103 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"form-data": "^4.0.0",
"glob": "^10.0.0",
"shelljs": "^0.8.5",
"starknet": "~5.19.3"
"starknet": "~5.19.3",
"tar-fs": "^3.0.4"
},
"peerDependencies": {
"hardhat": "^2.14.0"
Expand All @@ -55,6 +56,7 @@
"@types/mocha": "^10.0.0",
"@types/node": "^18.0.0",
"@types/shelljs": "^0.8.11",
"@types/tar-fs": "^2.0.1",
"@typescript-eslint/eslint-plugin": "^5.8.1",
"@typescript-eslint/parser": "^5.8.1",
"chai": "^4.3.7",
Expand Down
35 changes: 16 additions & 19 deletions scripts/setup-compiler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

set -eu


CAIRO_COMPILER_TARGET_TAG=$(jq -r .CAIRO_COMPILER config.json)

CAIRO_COMPILER_TARGET_TAG=$CAIRO_COMPILER
echo "Installing cairo compiler $CAIRO_COMPILER_TARGET_TAG"

CAIRO_COMPILER_ASSET_NAME="release-x86_64-unknown-linux-musl.tar.gz"
Expand All @@ -13,21 +11,20 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
CAIRO_COMPILER_ASSET_NAME="release-aarch64-apple-darwin.tar"
fi

COMPILER_BINARY_URL="https://github.com/starkware-libs/cairo/releases/download/$CAIRO_COMPILER_TARGET_TAG/$CAIRO_COMPILER_ASSET_NAME"

if [ -z "${CAIRO_1_COMPILER_DIR+x}" ]; then
# Setup cairo1 compiler
echo $COMPILER_BINARY_URL
mkdir -p cairo-compiler/target/release
curl --location -O --request GET "$COMPILER_BINARY_URL"
# Unzip asset and move to correct target
tar -zxvf $CAIRO_COMPILER_ASSET_NAME -C cairo-compiler --strip-components=1
mv cairo-compiler/bin/* cairo-compiler/target/release/
mv cairo-compiler/corelib cairo-compiler/target/corelib
# Remove empty directory and asset
rm -rf $CAIRO_COMPILER_ASSET_NAME cairo-compiler/bin
export CAIRO_1_COMPILER_DIR="$(readlink -f "cairo-compiler/target/release")"
fi
# Download compiler asset
COMPILER_BINARY_URL="https://github.com/starkware-libs/cairo/releases/download/v$CAIRO_COMPILER_TARGET_TAG/$CAIRO_COMPILER_ASSET_NAME"
echo "Downloading $COMPILER_BINARY_URL"
curl --location -O "$COMPILER_BINARY_URL"

$CAIRO_1_COMPILER_DIR/starknet-compile --version
# Unpack and remove archive
tar -zxvf "$CAIRO_COMPILER_ASSET_NAME"
rm -rf "$CAIRO_COMPILER_ASSET_NAME"

# For verification and future use
# Using absolute path to make it usable everywhere
export CAIRO_1_COMPILER_DIR=$(readlink -f "cairo/bin")

# Verify
echo "Verifying compiler binaries"
$CAIRO_1_COMPILER_DIR/starknet-compile --version
$CAIRO_1_COMPILER_DIR/starknet-sierra-compile --version
Loading