Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 16 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,18 @@ jobs:
command: cond_spot_run_build avm-transpiler 32
aztec_manifest_key: avm-transpiler

aztec-nargo:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
steps:
- *checkout
- *setup_env
- run:
name: "Build"
command: cond_spot_run_build aztec-nargo 32
aztec_manifest_key: aztec-nargo

l1-contracts:
machine:
image: default
Expand Down Expand Up @@ -381,7 +393,7 @@ jobs:
name: "Release to dockerhub"
command: |
should_release || exit 0
deploy_dockerhub noir
deploy_dockerhub aztec-nargo
deploy_dockerhub aztec
deploy_dockerhub aztec-builder
- run:
Expand Down Expand Up @@ -492,6 +504,9 @@ workflows:
# Transpiler
- avm-transpiler: *defaults

# aztec-nargo (nargo & transpiler)
- aztec-nargo: *defaults

# Barretenberg
- barretenberg-x86_64-linux-clang: *defaults
- barretenberg-x86_64-linux-clang-assert: *defaults
Expand Down
5 changes: 3 additions & 2 deletions avm-transpiler/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ WORKDIR /usr/src/avm-transpiler
RUN apt-get update && apt-get install -y git
RUN ./scripts/bootstrap_native.sh

FROM ubuntu:focal
FROM ubuntu:noble
COPY --from=0 /usr/src/avm-transpiler/scripts/compile_then_transpile.sh /usr/src/avm-transpiler/scripts/compile_then_transpile.sh
COPY --from=0 /usr/src/avm-transpiler/target/release/avm-transpiler /usr/src/avm-transpiler/target/release/avm-transpiler
ENTRYPOINT ["sh", "-c"]
ENTRYPOINT ["/usr/src/avm-transpiler/target/release/avm-transpiler"]
21 changes: 10 additions & 11 deletions avm-transpiler/Earthfile
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

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"]
30 changes: 30 additions & 0 deletions avm-transpiler/scripts/compile_then_transpile.sh
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
19 changes: 19 additions & 0 deletions aztec-nargo/Dockerfile
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

# 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"]
17 changes: 17 additions & 0 deletions aztec-nargo/Earthfile
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

# 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
4 changes: 2 additions & 2 deletions aztec-up/bin/.aztec-run
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ while [[ "$#" -gt 0 ]]; do
esac
done

# Dynamic port assignment based on IMAGE containing '/aztec' and not containing 'builder' (to exclude aztec-builder)
# Dynamic port assignment
port_assignment=""
if [[ "$IMAGE" == *"/aztec"* ]] && [[ "$IMAGE" != *"builder"* ]]; then
if [[ -z "${SKIP_PORT_ASSIGNMENT:-}" ]]; then
port_assignment="-p $AZTEC_PORT:$AZTEC_PORT"
fi

Expand Down
2 changes: 1 addition & 1 deletion aztec-up/bin/aztec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -euo pipefail
if [ -n "${1-}" ] && [ "$1" != "--help" ]; then
if [ "$1" == "cli" ]; then
shift
$(dirname $0)/.aztec-run aztecprotocol/cli "$@"
SKIP_PORT_ASSIGNMENT=1 $(dirname $0)/.aztec-run aztecprotocol/cli "$@"
elif [ "$1" == "sandbox" ]; then
$(dirname $0)/aztec-sandbox
else
Expand Down
1 change: 1 addition & 0 deletions aztec-up/bin/aztec-builder
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail

export SKIP_PORT_ASSIGNMENTS=1
export ENV_VARS_TO_INJECT="PXE_URL PRIVATE_KEY DEBUG"
export PXE_URL=${PXE_URL:-"http://host.docker.internal:8080"}
export ETHEREUM_HOST=${ETHEREUM_HOST:-"http://host.docker.internal:8545"}
Expand Down
2 changes: 1 addition & 1 deletion aztec-up/bin/aztec-install
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ export DOCKER_CLI_HINTS=false

if [ -z "${SKIP_PULL:-}" ]; then
info "Pulling aztec version $VERSION..."
pull_container aztec-nargo
pull_container aztec
pull_container noir
pull_container aztec-builder
fi

Expand Down
7 changes: 4 additions & 3 deletions aztec-up/bin/aztec-nargo
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
set -euo pipefail

export SKIP_NET=1
export SKIP_PORT_ASSIGNMENT=1
export PATH=$PATH:$HOME/bin

if [ "${1:-}" == "lsp" ]; then
docker run -i -v $HOME:$HOME -e HOME=$HOME aztecprotocol/noir $@
docker run -i -v $HOME:$HOME -e HOME=$HOME aztecprotocol/aztec-nargo $@
else
$(dirname $0)/.aztec-run aztecprotocol/noir $@
fi
$(dirname $0)/.aztec-run aztecprotocol/aztec-nargo $@
fi
13 changes: 13 additions & 0 deletions build_manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@ avm-transpiler:
rebuildPatterns:
- ^avm-transpiler/
- ^noir/
dependencies:
- noir

aztec-nargo:
buildDir: .
dockerfile: aztec-nargo/Dockerfile
rebuildPatterns:
- ^aztec-nargo/
- ^avm-transpiler/
- ^noir/
dependencies:
- avm-transpiler
- noir

# Compiles all aztec noir projects using nargo and the avm-transpiler.
noir-projects:
Expand Down
9 changes: 0 additions & 9 deletions noir/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,6 @@ packages-test:
BUILD +packages-test-node
BUILD +packages-test-browser

run:
# When running the container, mount the users home directory to same location.
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
COPY +build/. /usr/src
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/src/nargo"]

build-acir-tests:
LOCALLY
# Prepare our exact dependency formula, this avoids problems with copied empty folders or build artifacts
Expand Down