-
Notifications
You must be signed in to change notification settings - Fork 599
feat(sandbox): auto transpile public contract functions in sandbox #6140
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3eb498f
feat(nargo): hidden option to show contract artifact paths written to by
03fdb67
feat(sandbox): auto transpile public contract functions in sandbox
7e00484
[skip ci] aztec-nargo
2c16261
fix .aztec-run
ab76200
fix earthly file for aztec-nargo
8440c69
cleanup old dockerfile
9d2d62b
[skip ci]
02daa38
formatting fix
29419ca
compile then transpile script should return nargo's return status in …
547ad4f
SKIP_PORT_ASSIGNMENT flag to .aztec-run, simplify compile_then_transp…
e7513c0
typo
4d1bb85
merge
a3a148a
merge
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,29 @@ | ||
| VERSION 0.8 | ||
| IMPORT ../noir AS noir | ||
|
|
||
| source: | ||
| # we rely on noir source, which this image has | ||
| FROM noir+nargo | ||
| # we rely on noir source, which this image has | ||
| FROM ../noir+nargo | ||
|
|
||
| # move noir contents to /usr/src/noir | ||
| RUN mv /usr/src /noir && mkdir /usr/src && mv /noir /usr/src | ||
| # work in avm-transpiler | ||
| WORKDIR /usr/src/avm-transpiler | ||
| # move noir contents to /usr/src/noir | ||
| RUN mv /usr/src /noir && mkdir /usr/src && mv /noir /usr/src | ||
| # work in avm-transpiler | ||
| WORKDIR /usr/src/avm-transpiler | ||
|
|
||
| COPY --dir scripts src Cargo.lock Cargo.toml rust-toolchain.toml .rustfmt.toml . | ||
| COPY --dir scripts src Cargo.lock Cargo.toml rust-toolchain.toml .rustfmt.toml . | ||
|
|
||
| build: | ||
| FROM +source | ||
| # build avm transpiler, and make sure the big build and deps folders don't hit cache | ||
| RUN ./scripts/bootstrap_native.sh && rm -rf target/release/{build,deps} | ||
| SAVE ARTIFACT target/release/avm-transpiler avm-transpiler | ||
| SAVE ARTIFACT scripts/compile_then_transpile.sh | ||
dbanks12 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| format: | ||
| FROM +source | ||
| RUN cargo fmt --check | ||
| RUN cargo clippy | ||
|
|
||
| run: | ||
| #TODO needed? | ||
| FROM ubuntu:focal | ||
| FROM ubuntu:noble | ||
| COPY +build/avm-transpiler /usr/src/avm-transpiler | ||
| ENTRYPOINT ["sh", "-c"] | ||
| ENTRYPOINT ["/usr/src/avm-transpiler"] | ||
dbanks12 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #!/usr/bin/env bash | ||
| # This is a wrapper script for nargo. | ||
| # Pass any args that you'd normally pass to nargo. | ||
| # If the first arg is "compile", | ||
| # run nargo and then transpile any created artifacts. | ||
| # | ||
| # Usage: compile_then_transpile.sh [nargo args] | ||
| set -eu | ||
|
|
||
| NARGO=${NARGO:-nargo} | ||
| TRANSPILER=${TRANSPILER:-avm-transpiler} | ||
|
|
||
| if [ "${1:-}" != "compile" ]; then | ||
| # if not compiling, just pass through to nargo verbatim | ||
| $NARGO $@ | ||
| exit $? | ||
| fi | ||
| shift # remove the compile arg so we can inject --show-artifact-paths | ||
|
|
||
| # Forward all arguments to nargo, tee output to console | ||
| artifacts_to_transpile=$($NARGO compile --show-artifact-paths $@ | tee /dev/tty | grep -oP 'Saved contract artifact to: \K.*') | ||
|
|
||
| # NOTE: the output that is teed to /dev/tty will normally not be redirectable by the caller. | ||
| # If the script is run via docker, however, the user will see this output on stdout and will be able to redirect. | ||
|
|
||
| # Transpile each artifact | ||
| for artifact in "$artifacts_to_transpile"; do | ||
| # transpiler input and output files are the same (modify in-place) | ||
| $TRANSPILER "$artifact" "$artifact" | ||
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # to get built nargo binary | ||
| FROM aztecprotocol/noir as built-noir | ||
|
|
||
| # to get built avm-transpiler binary | ||
| FROM aztecprotocol/avm-transpiler as built-transpiler | ||
|
|
||
|
|
||
| FROM ubuntu:noble | ||
| # Install Tini as nargo doesn't handle signals properly. | ||
| # Install git as nargo needs it to clone. | ||
| RUN apt-get update && apt-get install -y git tini && rm -rf /var/lib/apt/lists/* && apt-get clean | ||
dbanks12 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Copy binaries to /usr/bin | ||
| COPY --from=built-noir /usr/src/noir/noir-repo/target/release/nargo /usr/bin/nargo | ||
| COPY --from=built-transpiler /usr/src/avm-transpiler/target/release/avm-transpiler /usr/bin/avm-transpiler | ||
| # Copy in script that calls both binaries | ||
| COPY ./avm-transpiler/scripts/compile_then_transpile.sh /usr/src/avm-transpiler/scripts/compile_then_transpile.sh | ||
|
|
||
| ENTRYPOINT ["/usr/bin/tini", "--", "/usr/src/avm-transpiler/scripts/compile_then_transpile.sh"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| VERSION 0.8 | ||
|
|
||
| run: | ||
| FROM ubuntu:noble | ||
| # Install Tini as nargo doesn't handle signals properly. | ||
| # Install git as nargo needs it to clone. | ||
| RUN apt-get update && apt-get install -y git tini && rm -rf /var/lib/apt/lists/* && apt-get clean | ||
dbanks12 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Copy binaries to /usr/bin | ||
| COPY ../noir+nargo/nargo /usr/bin/nargo | ||
| COPY ../avm-transpiler+build/avm-transpiler /usr/bin/avm-transpiler | ||
| # Copy in script that calls both binaries | ||
| COPY ../avm-transpiler+build/compile_then_transpile.sh /usr/bin/compile_then_transpile.sh | ||
|
|
||
| ENV PATH "/usr/bin:${PATH}" | ||
| ENTRYPOINT ["/usr/bin/tini", "--", "/usr/bin/compile_then_transpile.sh"] | ||
| SAVE IMAGE aztecprotocol/aztec-nargo | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.