diff --git a/aztec-up/.gitignore b/aztec-up/.gitignore index cd60a81034c5..863980726183 100644 --- a/aztec-up/.gitignore +++ b/aztec-up/.gitignore @@ -1,5 +1,5 @@ .terraform .terraform* .DS_Store -bin/versions +bin/0.0.1/versions verdaccio-storage diff --git a/aztec-up/Dockerfile b/aztec-up/Dockerfile index 9a4cef2010dd..2a292cee2f3b 100644 --- a/aztec-up/Dockerfile +++ b/aztec-up/Dockerfile @@ -7,8 +7,6 @@ RUN apt update && apt install -y \ build-essential \ python3 \ netcat-openbsd \ - parallel \ - jq \ && rm -rf /var/lib/apt/lists/* COPY --chown=1000:1000 verdaccio-storage /home/ubuntu/verdaccio-storage RUN touch /aztec_release_test_container diff --git a/aztec-up/bin/0.0.1/install b/aztec-up/bin/0.0.1/install new file mode 100755 index 000000000000..181d21d932ca --- /dev/null +++ b/aztec-up/bin/0.0.1/install @@ -0,0 +1,157 @@ +#!/usr/bin/env bash +# Per-version installer script +# This script is called by aztec-up to install a specific version of the Aztec toolchain. +# It expects VERSION and INSTALL_URI to be set. +set -euo pipefail + +# Colors +g="\033[32m" # Green +y="\033[33m" # Yellow +b="\033[34m" # Blue +r="\033[0m" # Reset + +# Required environment variables +VERSION="${VERSION:?VERSION must be set}" +AZTEC_HOME="${AZTEC_HOME:-$HOME/.aztec}" +INSTALL_URI="${INSTALL_URI:-https://install.aztec.network}" + +# Version-specific paths +version_path="$AZTEC_HOME/versions/$VERSION" +version_bin_path="$version_path/bin" + +function echo_green { + echo -e "${g}$1${r}" +} + +function echo_yellow { + echo -e "${y}$1${r}" +} + +function dump_fail { + output=$(mktemp) + + set +e + ($1) &>$output + status=$? + set -e + + # 0 or SIGTERM considered a success. + if [ "$status" -ne 0 ] && [ "$status" -ne 143 ]; then + { + echo + echo -e "${y}command failed${r}: $1 (exit: $status)" + echo -e "${b}--- output ---${r}" + cat $output + } >&2 + fi + + rm $output + + return $status +} + +function check_toolchains { + # Check Node.js version. + local node_min_version=$(cat "$version_path/versions" | grep node | cut -d' ' -f2) + local node_installed_version=$(node --version 2>/dev/null | cut -d 'v' -f 2 || echo "none") + if [[ "$(printf '%s\n' "$node_min_version" "$node_installed_version" | sort -V | head -n1)" != "$node_min_version" ]]; then + echo "Minimum Node.js version $node_min_version not found (got $node_installed_version)." + echo "Installation: nvm install --lts && nvm alias default lts/*" + exit 1 + fi +} + +function install_versions_file { + # Determine the correct URI for fetching the versions file + local versions_uri="$INSTALL_URI" + curl -fsSL "$versions_uri/$VERSION/versions" -o "$version_path/versions" +} + +function install_noir { + set -euo pipefail + local noir_version=$(cat "$version_path/versions" | grep noir | cut -d' ' -f2) + + # Create a temp directory for noirup to install to + local temp_nargo_home=$(mktemp -d) + mkdir -p "$temp_nargo_home/bin" + + # Install noirup if not already present + if [ ! -f "$HOME/.nargo/bin/noirup" ]; then + curl -Ls https://raw.githubusercontent.com/noir-lang/noirup/refs/heads/main/install | bash + fi + + # Install noir to temp location and move to version directory + NARGO_HOME="$temp_nargo_home" "$HOME/.nargo/bin/noirup" -v "$noir_version" + + # Move the nargo binary to our version bin directory + mv "$temp_nargo_home/bin/nargo" "$version_bin_path/nargo" + + # Cleanup temp directory + rm -rf "$temp_nargo_home" +} + +function install_foundry { + set -euo pipefail + local foundry_version=$(cat "$version_path/versions" | grep foundry | cut -d' ' -f2) + + # Create a temp directory for foundryup to install to + local temp_foundry_dir=$(mktemp -d) + mkdir -p "$temp_foundry_dir/bin" + + # Install foundryup if not already present + if [ ! -f "$HOME/.foundry/bin/foundryup" ]; then + curl -L https://foundry.paradigm.xyz | bash + fi + + # Install foundry to temp location and move to version directory + FOUNDRY_DIR="$temp_foundry_dir" "$HOME/.foundry/bin/foundryup" -i "$foundry_version" + + # Move the foundry binaries to our version bin directory + for binary in forge cast anvil chisel; do + if [ -f "$temp_foundry_dir/bin/$binary" ]; then + mv "$temp_foundry_dir/bin/$binary" "$version_bin_path/$binary" + fi + done + + # Cleanup temp directory + rm -rf "$temp_foundry_dir" +} + +function install_aztec_packages { + set -euo pipefail + local aztec_version=$(cat "$version_path/versions" | grep aztec | cut -d' ' -f2) + + # Install npm packages to the version directory using --prefix + npm install @aztec/aztec@"$aztec_version" @aztec/cli-wallet@"$aztec_version" @aztec/bb.js@"$aztec_version" \ + --prefix "$version_path" +} + +function main { + # Create version directory + mkdir -p "$version_bin_path" + + # Download versions manifest + echo -n "Installing version manifest... " + dump_fail install_versions_file + echo_green "done." + + # Check Node.js version + check_toolchains + + # Install noir + echo -n "Installing nargo... " + dump_fail install_noir + echo_green "done." + + # Install foundry + echo -n "Installing foundry... " + dump_fail install_foundry + echo_green "done." + + # Install aztec npm packages + echo -n "Installing aztec packages... " + dump_fail install_aztec_packages + echo_green "done." +} + +main "$@" diff --git a/aztec-up/bin/aliases/index b/aztec-up/bin/aliases/index new file mode 100644 index 000000000000..f097ba80de5f --- /dev/null +++ b/aztec-up/bin/aliases/index @@ -0,0 +1,2 @@ +latest +nightly diff --git a/aztec-up/bin/aliases/latest b/aztec-up/bin/aliases/latest new file mode 100644 index 000000000000..8acdd82b765e --- /dev/null +++ b/aztec-up/bin/aliases/latest @@ -0,0 +1 @@ +0.0.1 diff --git a/aztec-up/bin/aliases/nightly b/aztec-up/bin/aliases/nightly new file mode 100644 index 000000000000..8acdd82b765e --- /dev/null +++ b/aztec-up/bin/aliases/nightly @@ -0,0 +1 @@ +0.0.1 diff --git a/aztec-up/bin/aztec-install b/aztec-up/bin/aztec-install index 9e21ec60d84a..80c74f96c24c 100755 --- a/aztec-up/bin/aztec-install +++ b/aztec-up/bin/aztec-install @@ -1,4 +1,8 @@ #!/usr/bin/env bash +# Root bootstrap script for Aztec toolchain +# This script installs aztec-up and then delegates to it for version installation. +# Usage: curl -s https://install.aztec.network | bash +# or: VERSION=0.85.0 curl -s https://install.aztec.network | bash set -euo pipefail # Colors @@ -15,16 +19,15 @@ else NON_INTERACTIVE=${NON_INTERACTIVE:-0} fi -aztec_path=$HOME/.aztec -bin_path=$aztec_path/bin +# Base paths +AZTEC_HOME="${AZTEC_HOME:-$HOME/.aztec}" +shared_bin_path="$AZTEC_HOME/bin" -# For testing you can override the INSTALL_URI to point to a file uri e.g. file:///home/user/aztec-packages/aztec-up/bin -if [ -z "${INSTALL_URI:-}" ]; then - INSTALL_URI=https://install.aztec.network - if [ -n "${VERSION:-}" ]; then - INSTALL_URI+="/$VERSION" - fi -fi +# VERSION can be set externally +VERSION="${VERSION:-latest}" + +# Install URI (root, not version-specific) +INSTALL_URI="${INSTALL_URI:-https://install.aztec.network}" # Add color to the AZTEC ascii art. function print_colored() { @@ -46,6 +49,8 @@ function title() { echo -e "${r}" echo -e "Welcome to the ${bold}${b}Aztec${r} installer! Your journey into blockchain privacy begins... ${bold}${p}now${r}." echo + echo -e "Installing version: ${bold}${g}$VERSION${r}" + echo echo -e "This install script will install the following and update your PATH if necessary:" echo -e " ${bold}${g}nargo${r} - the version of the noir programming language compatible with this version of aztec." echo -e " ${bold}${g}bb${r} - the version of the barretenberg proving backend compatible with this version of aztec." @@ -69,88 +74,7 @@ function echo_yellow { echo -e "${y}$1${r}" } -function echo_purple { - echo -e "${p}$1${r}" -} - -function dump_fail { - output=$(mktemp) - - set +e - ($1) &>$output - status=$? - set -e - - # 0 or SIGTERM considered a success. - if [ "$status" -ne 0 ] && [ "$status" -ne 143 ]; then - { - echo - echo -e "${y}command failed${r}: $1 (exit: $status)" - echo -e "${b}--- output ---${r}" - cat $output - } >&2 - fi - - rm $output - - return $status -} - -function check_toolchains { - # Check Node.js version. - local versions=$(curl -fsSL "$INSTALL_URI/versions") - local node_min_version=$(echo "$versions" | grep node | cut -d' ' -f2) - local node_installed_version=$(node --version | cut -d 'v' -f 2 || echo "none") - if [[ "$(printf '%s\n' "$node_min_version" "$node_installed_version" | sort -V | head -n1)" != "$node_min_version" ]]; then - echo "Minimum Node.js version $node_min_version not found (got $node_installed_version)." - echo "Installation: nvm install --lts && nvm alias default lts/*" - exit 1 - fi -} - -function install_file { - local dest="$aztec_path/$1" - curl -fsSL "$INSTALL_URI/$1" -o "$dest" - echo "Installed: $dest" -} - -# Copy a file from the install source path to the bin path and make it executable. -function install_bin { - local dest="$bin_path/$1" - curl -fsSL "$INSTALL_URI/$1" -o "$dest" - chmod +x "$dest" - echo "Installed: $dest" -} - -# Updates appropriate shell script to ensure the bin path is in the PATH. -function update_path_env_var { - local target_dir=$bin_path - # Check if the target directory is in the user's PATH. - if [[ ":$PATH:" == *":$target_dir:"* ]]; then - return - fi - - # Determine the user's shell. - local shell_profile="" - case $SHELL in - */bash) - shell_profile="$HOME/.bashrc" - ;; - */zsh) - shell_profile="$HOME/.zshrc" - ;; - *) - echo "Unsupported shell: $SHELL" - return - ;; - esac - - # Add the target directory to the user's PATH in their profile. - echo "export PATH=\"\$PATH:$target_dir\"" >>"$shell_profile" -} - function install_jq { - set -euo pipefail url_base="https://github.com/jqlang/jq/releases/download/jq-1.8.1" arch="$(uname -m)" os="$(uname -s)" @@ -176,76 +100,83 @@ function install_jq { ;; esac - curl -Ls "$url_base/$bin" -o $bin_path/jq || return 1 - chmod +x $bin_path/jq + curl -Ls "$url_base/$bin" -o $shared_bin_path/jq || return 1 + chmod +x $shared_bin_path/jq } function install_aztec_up { - set -euo pipefail - mkdir -p $bin_path - rm -f $bin_path/* - install_bin aztec-up - install_file versions - update_path_env_var + # Download aztec-up from root (not version-specific) + curl -fsSL "$INSTALL_URI/aztec-up" -o "$shared_bin_path/aztec-up" + chmod +x "$shared_bin_path/aztec-up" } -function install_noir { - set -euo pipefail - curl -Ls https://raw.githubusercontent.com/noir-lang/noirup/refs/heads/main/install | bash - $HOME/.nargo/bin/noirup -v $(cat $aztec_path/versions | grep noir | cut -d' ' -f2) -} +# Updates appropriate shell script to ensure the paths are in PATH. +function update_path_env_var { + # We need both: + # - $AZTEC_HOME/current/bin and $AZTEC_HOME/current/node_modules/.bin for version-specific tools + # - $AZTEC_HOME/bin for shared tools like aztec-up + local path_line="export PATH=\"\$HOME/.aztec/current/bin:\$HOME/.aztec/current/node_modules/.bin:\$HOME/.aztec/bin:\$PATH\"" -function install_foundry { - set -euo pipefail - curl -L https://foundry.paradigm.xyz | bash - $HOME/.foundry/bin/foundryup -i $(cat $aztec_path/versions | grep foundry | cut -d' ' -f2) -} + # Determine the user's shell. + local shell_profile="" + case $SHELL in + */bash) + shell_profile="$HOME/.bashrc" + ;; + */zsh) + shell_profile="$HOME/.zshrc" + ;; + *) + echo "Unsupported shell: $SHELL" + return + ;; + esac + + # Check if we already have aztec paths in the profile + if grep -q '\.aztec' "$shell_profile" 2>/dev/null; then + # Remove old aztec PATH entries and add new one + local tmp_file=$(mktemp) + grep -v '\.aztec' "$shell_profile" > "$tmp_file" || true + mv "$tmp_file" "$shell_profile" + fi -function install_aztec_packages { - set -euo pipefail - local version=$(cat $aztec_path/versions | grep aztec | cut -d' ' -f2) - npm i -g @aztec/aztec@$version @aztec/cli-wallet@$version @aztec/bb.js@$version + # Add the path line + echo "$path_line" >>"$shell_profile" } function main { # Show title if we're in a terminal. [ "$NON_INTERACTIVE" -eq 0 ] && title - check_toolchains - - # Install aztec-up - echo -n "Installing aztec-up... " - dump_fail install_aztec_up - echo_green "done." + mkdir -p "$shared_bin_path" # Install jq echo -n "Installing jq... " - dump_fail install_jq + install_jq echo_green "done." - # Install noir - echo -n "Installing nargo... " - dump_fail install_noir + # Install aztec-up (version manager) + echo -n "Installing aztec-up... " + install_aztec_up echo_green "done." - # Install foundry - echo -n "Installing foundry... " - dump_fail install_foundry - echo_green "done." + # Update PATH + update_path_env_var - # Install aztec - echo -n "Installing aztec packages... " - dump_fail install_aztec_packages - echo_green "done." + # Export PATH for this session so aztec-up is available + export PATH="$shared_bin_path:$PATH" + + # Use aztec-up to install the requested version + aztec-up install $VERSION if [ "$NON_INTERACTIVE" -eq 0 ] && [ "${NO_NEW_SHELL:-0}" -eq 0 ]; then echo_green "Done! Starting fresh shell..." exec $SHELL else echo - echo -e "${g}Done!${r} You'll need to start a fresh shell to see PATH updates." + echo "Done! You'll need to start a fresh shell to see PATH updates." + echo fi } -cmd="${1:-main}"; -$cmd +main "$@" diff --git a/aztec-up/bin/aztec-up b/aztec-up/bin/aztec-up index 00bfc351cc63..5d6769f96e48 100755 --- a/aztec-up/bin/aztec-up +++ b/aztec-up/bin/aztec-up @@ -1,51 +1,288 @@ #!/usr/bin/env bash set -euo pipefail -export VERSION=${1:-${VERSION:-}} -export NON_INTERACTIVE=1 -INSTALL_URI=${INSTALL_URI:-https://install.aztec.network} +# Colors +g="\033[32m" # Green +y="\033[33m" # Yellow +b="\033[34m" # Blue +r="\033[0m" # Reset -function help() { - echo "Usage: aztec-up [options]" +AZTEC_HOME="${AZTEC_HOME:-$HOME/.aztec}" +INSTALL_URI="${INSTALL_URI:-https://install.aztec.network}" + +function echo_green { + echo -e "${g}$1${r}" +} + +function echo_yellow { + echo -e "${y}$1${r}" +} + +function echo_blue { + echo -e "${b}$1${r}" +} + +function help { + echo "aztec-up - Aztec version manager" + echo + echo "Usage: aztec-up [command] [options]" + echo + echo "Commands:" + echo " install Install a version (does not switch to it)" + echo " use [] Switch to an installed version (or read from .aztecrc)" + echo " list List installed versions" + echo " uninstall Remove an installed version" + echo " self-update Update aztec-up itself to the latest version" + echo echo "Options:" - echo " -v, --version Install a specific version of Aztec" - echo " -h, --help Show this help message" + echo " -h, --help Show this help message" + echo + echo "Examples:" + echo " aztec-up install Install the latest version" + echo " aztec-up install nightly Install the latest nightly version" + echo " aztec-up install 0.85.0 Install a specific version" + echo " aztec-up use 0.85.0 Switch to version 0.85.0" + echo " aztec-up use Read version from .aztecrc and switch to it" + echo " aztec-up list Show all installed versions" + echo " aztec-up self-update Update aztec-up to latest" } -# Parse optional version argument -while [[ $# -gt 0 ]]; do - case $1 in - -v|--version) - VERSION="$2" - shift # past argument - shift # past value - ;; - -h|--help) +# Get the currently active version (from the 'current' symlink) +function get_current_version { + if [ -L "$AZTEC_HOME/current" ]; then + basename "$(readlink "$AZTEC_HOME/current")" + else + echo "" + fi +} + +# Find .aztecrc file by searching up the directory tree +function find_aztecrc { + local dir="$PWD" + while [ "$dir" != "/" ] && [ "$dir" != "$HOME" ]; do + if [ -f "$dir/.aztecrc" ]; then + echo "$dir/.aztecrc" + return 0 + fi + dir="$(dirname "$dir")" + done + # Also check $HOME + if [ -f "$HOME/.aztecrc" ]; then + echo "$HOME/.aztecrc" + return 0 + fi + return 1 +} + +# Read version from .aztecrc file (first non-comment, non-empty line) +function read_aztecrc { + local file="$1" + grep -v '^#' "$file" | grep -v '^$' | head -n 1 | tr -d '[:space:]' +} + +# Check if a version is installed +function is_version_installed { + local version="$1" + [ -d "$AZTEC_HOME/versions/$version" ] +} + +# Check if version string is valid semver +function is_semver { + local version="$1" + # Match semver: X.Y.Z with optional pre-release and build metadata + local semver_regex='^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?(\+[a-zA-Z0-9.]+)?$' + [[ "$version" =~ $semver_regex ]] +} + +# Resolve alias (like "latest") to actual version number +function resolve_version { + local version="$1" + if is_semver "$version"; then + echo "$version" + else + # Fetch alias file to get actual version + local resolved + if ! resolved=$(curl -fsSL "$INSTALL_URI/aliases/$version" 2>/dev/null); then + echo "Error: Could not resolve alias '$version'" >&2 + return 1 + fi + echo "$resolved" + fi +} + +# Install a version by downloading and running the version-specific installer +function cmd_install { + local version="${1:-latest}" + + # Resolve alias to actual version + local resolved_version + if ! resolved_version=$(resolve_version "$version"); then + exit 1 + fi + + local install_url="$INSTALL_URI/$resolved_version/install" + + # Check if install script exists + if ! curl --head --silent --fail "$install_url" > /dev/null; then + echo "Error: Version installer not found at $install_url" + echo "Please check the version specified." + exit 1 + fi + + # Download and run the version-specific installer + curl -fsSL "$install_url" | VERSION="$resolved_version" bash + + # Update the current symlink + ln -sfn "$AZTEC_HOME/versions/$resolved_version" "$AZTEC_HOME/current" +} + +# Switch to a version +function cmd_use { + local version="${1:-}" + + # If no version specified, try to read from .aztecrc + if [ -z "$version" ]; then + local aztecrc_file + if aztecrc_file=$(find_aztecrc); then + version=$(read_aztecrc "$aztecrc_file") + echo_blue "Found .aztecrc: $aztecrc_file" + else + echo "Error: No version specified and no .aztecrc file found." + echo "Usage: aztec-up use " + echo " or: aztec-up use (with .aztecrc file in current or parent directory)" + exit 1 + fi + fi + + # Resolve alias to actual version + local resolved_version + if ! resolved_version=$(resolve_version "$version"); then + exit 1 + fi + + # Check if version is installed + if ! is_version_installed "$resolved_version"; then + echo "Error: Version $resolved_version is not installed." + echo "Run 'aztec-up install $version' to install it first." + exit 1 + fi + + # Update the current symlink + ln -sfn "$AZTEC_HOME/versions/$resolved_version" "$AZTEC_HOME/current" + echo_green "Now using aztec $resolved_version" +} + +# List installed versions and available aliases +function cmd_list { + local current_version + current_version=$(get_current_version) + + # Show installed versions + if [ -d "$AZTEC_HOME/versions" ] && [ -n "$(ls -A "$AZTEC_HOME/versions" 2>/dev/null)" ]; then + echo "Installed versions:" + echo + for dir in "$AZTEC_HOME/versions"/*/; do + if [ -d "$dir" ]; then + local version + version=$(basename "$dir") + if [ "$version" = "$current_version" ]; then + echo -e "${g}* ${version} (current)${r}" + else + echo " $version" + fi + fi + done + else + echo "No versions installed." + fi + + # Show available aliases + echo + echo "Aliases:" + local index + if index=$(curl -fsSL "$INSTALL_URI/aliases/index" 2>/dev/null); then + while IFS= read -r alias_name; do + [ -z "$alias_name" ] && continue + local resolved + if resolved=$(curl -fsSL "$INSTALL_URI/aliases/$alias_name" 2>/dev/null); then + echo " $alias_name -> $resolved" + fi + done <<< "$index" + else + echo " (could not fetch aliases)" + fi +} + +# Uninstall a version +function cmd_uninstall { + local version="${1:-}" + + if [ -z "$version" ]; then + echo "Error: Please specify a version to uninstall." + echo "Usage: aztec-up uninstall " + exit 1 + fi + + if ! is_version_installed "$version"; then + echo "Error: Version $version is not installed." + exit 1 + fi + + local current_version + current_version=$(get_current_version) + + if [ "$version" = "$current_version" ]; then + echo_yellow "Warning: You are uninstalling the currently active version." + echo "You will need to run 'aztec-up use ' to switch to another version." + rm -f "$AZTEC_HOME/current" + fi + + # Remove the version directory + rm -rf "$AZTEC_HOME/versions/$version" + + echo_green "Uninstalled version $version" +} + +# Update aztec-up itself +function cmd_self-update { + echo "Updating aztec-up..." + + local self_path="$AZTEC_HOME/bin/aztec-up" + local tmp_path=$(mktemp) + + # Download latest aztec-up from root + if ! curl -fsSL "$INSTALL_URI/aztec-up" -o "$tmp_path"; then + echo "Error: Failed to download latest aztec-up" + rm -f "$tmp_path" + exit 1 + fi + + # Replace self + chmod +x "$tmp_path" + mv "$tmp_path" "$self_path" + + echo_green "aztec-up updated successfully." + echo "Run 'aztec-up --help' to see available commands." +} + +# Main entry point +function main { + local cmd="${1:-}" + shift || true + + case "$cmd" in + ""|-h|--help) help - exit 0 + ;; + install|use|list|uninstall|self-update) + cmd_$cmd "$@" ;; *) - # Skip unknown options - shift + echo "Unknown command: $cmd" + help + exit 1 ;; esac -done - -if [ "$VERSION" = "master" ]; then - echo "Error: The 'master' version is deprecated. Please use 'nightly' instead." - exit 1 -fi - -if [ -n "$VERSION" ] && [ "$VERSION" != "latest" ]; then - install_url="$INSTALL_URI/$VERSION/aztec-install" -else - install_url="$INSTALL_URI/aztec-install" -fi - -if curl --head --silent --fail "$install_url" > /dev/null; then - bash <(curl -s "$install_url") -else - echo "Error: Install script not found at $install_url" - echo "Please check the version specified." - exit 1 -fi +} + +main "$@" diff --git a/aztec-up/bootstrap.sh b/aztec-up/bootstrap.sh index 3388da771e31..0ac4bf57ce9d 100755 --- a/aztec-up/bootstrap.sh +++ b/aztec-up/bootstrap.sh @@ -5,9 +5,9 @@ hash=$(hash_str $(cache_content_hash ^aztec-up/) $(../yarn-project/bootstrap.sh function build { # Create versions.json so we know what to install. - ../bootstrap.sh versions > ./bin/versions + ../bootstrap.sh versions > ./bin/0.0.1/versions echo "Versions:" - cat ./bin/versions + cat ./bin/0.0.1/versions echo # Create Verdaccio config. @@ -59,7 +59,7 @@ registry=http://localhost:4873/ EOF # Deploy all npm packages to local registry. - version=$(cat ./bin/versions | grep aztec | cut -d' ' -f2) + version=0.0.1 echo "Deploying packages to local npm registry (version: $version)..." { echo $root/barretenberg/ts @@ -93,16 +93,12 @@ function release { local version=${REF_NAME#v} local source_dir=./bin - # Always create a version directory and upload files there. - do_or_dryrun aws s3 sync $source_dir "s3://install.aztec.network/$version/" + # Always upload version-specific files to version directory + do_or_dryrun aws s3 cp $source_dir/0.0.1/install "s3://install.aztec.network/$version/install" + do_or_dryrun aws s3 cp $source_dir/0.0.1/versions "s3://install.aztec.network/$version/versions" - if [[ $(dist_tag) != "latest" ]]; then - # Also upload to a $dist_tag directory, if not latest. - do_or_dryrun aws s3 sync $source_dir "s3://install.aztec.network/$(dist_tag)/" - else - # Upload new version to root. - do_or_dryrun aws s3 sync $source_dir s3://install.aztec.network/ - fi + do_or_dryrun aws s3 cp - "s3://install.aztec.network/aliases/$(dist_tag)" <<< "$version" + do_or_dryrun aws s3 cp $source_dir/aliases/index "s3://install.aztec.network/aliases/index" } case "$cmd" in diff --git a/aztec-up/scripts/run_isolated_test.sh b/aztec-up/scripts/run_isolated_test.sh index 85635f319c03..d1e5bac68b74 100755 --- a/aztec-up/scripts/run_isolated_test.sh +++ b/aztec-up/scripts/run_isolated_test.sh @@ -15,7 +15,7 @@ fi # Install required node version. curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash source ~/.nvm/nvm.sh -node_version=$(grep node aztec-packages/aztec-up/bin/versions | cut -d' ' -f2) +node_version=$(grep node aztec-packages/aztec-up/bin/0.0.1/versions | cut -d' ' -f2) echo $node_version nvm install $node_version nvm alias default $node_version @@ -67,5 +67,6 @@ else fi bash ${bash_args:-} <(curl -s $INSTALL_URI/aztec-install) +exec bash # Run test. Force interactive to parse .bashrc. -bash -i aztec-packages/aztec-up/test/$1.sh +# bash -i aztec-packages/aztec-up/test/$1.sh diff --git a/aztec-up/scripts/run_test.sh b/aztec-up/scripts/run_test.sh index 601eeff6b621..1827bed2647c 100755 --- a/aztec-up/scripts/run_test.sh +++ b/aztec-up/scripts/run_test.sh @@ -10,25 +10,31 @@ function cleanup { trap 'cleanup' SIGINT SIGTERM EXIT cleanup -# If we're running in a terminal, run the container interactively. -# Drop into a shell if the test fails. +function run { + echo "Running test $name..." + docker run --rm ${args:-} \ + -e FORCE_COLOR=1 \ + --name $name \ + --tmpfs /home/ubuntu/.nvm:exec,size=4g \ + --tmpfs /home/ubuntu/.npm:exec,size=2g \ + -v$(git rev-parse --show-toplevel):/home/ubuntu/aztec-packages:ro \ + -v$HOME/.bb-crs:/home/ubuntu/.bb-crs \ + -w/home/ubuntu \ + --user ubuntu:ubuntu \ + aztecprotocol/aztec-release-test \ + bash -c " + aztec-packages/aztec-up/scripts/run_isolated_test.sh $name ${fail_shell:-} + " +} + if [ -t 0 ]; then + # If we're running in a terminal, run the container interactively. + # Drop into a shell if the test fails. args="-ti" fail_shell="|| exec bash" + run +else + # Otherwise run in background so we can promptly handle signals. + run & + wait $! fi - -echo "Running test $name..." -docker run --rm ${args:-} \ - -e FORCE_COLOR=1 \ - --name $name \ - --tmpfs /home/ubuntu/.nvm:exec,size=4g \ - --tmpfs /home/ubuntu/.npm:exec,size=2g \ - -v$(git rev-parse --show-toplevel):/home/ubuntu/aztec-packages:ro \ - -v$HOME/.bb-crs:/home/ubuntu/.bb-crs \ - -w/home/ubuntu \ - --user ubuntu:ubuntu \ - aztecprotocol/aztec-release-test \ - bash -c " - aztec-packages/aztec-up/scripts/run_isolated_test.sh $name ${fail_shell:-} - " & -wait $! diff --git a/bootstrap.sh b/bootstrap.sh index e3693545f11a..6560f36f6b12 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -150,11 +150,6 @@ function check_toolchains { } function versions { - if semver check $REF_NAME; then - echo "aztec: ${REF_NAME#v}" - else - echo "aztec: $(jq -r '."."' .release-please-manifest.json | tr -d v)" - fi echo "noir: $(git -C noir/noir-repo describe --tags --exact-match HEAD)" echo "foundry: $(anvil --version | head -n1 | sed -E 's/anvil Version: ([0-9.]+).*/\1/')" echo "node: $(node --version | cut -d 'v' -f 2)" diff --git a/yarn-project/aztec-faucet/package.json b/yarn-project/aztec-faucet/package.json index 0c18833e717b..d3ea97d39c56 100644 --- a/yarn-project/aztec-faucet/package.json +++ b/yarn-project/aztec-faucet/package.json @@ -3,7 +3,6 @@ "version": "0.1.0", "main": "dest/bin/index.js", "type": "module", - "bin": "./dest/bin/index.js", "exports": { ".": "./dest/index.js", "./config": "./dest/config.js" diff --git a/yarn-project/aztec-node/package.json b/yarn-project/aztec-node/package.json index 822c0cc86b11..07d4c9382261 100644 --- a/yarn-project/aztec-node/package.json +++ b/yarn-project/aztec-node/package.json @@ -9,7 +9,6 @@ "./sentinel": "./dest/aztec-node/sentinel.js", "./test": "./dest/test/index.js" }, - "bin": "./dest/bin/index.js", "typedocOptions": { "entryPoints": [ "./src/index.ts" diff --git a/yarn-project/aztec/scripts/compile.sh b/yarn-project/aztec/scripts/compile.sh index 7bec1e29d17f..ccf4233122fa 100755 --- a/yarn-project/aztec/scripts/compile.sh +++ b/yarn-project/aztec/scripts/compile.sh @@ -36,9 +36,16 @@ $BB aztec_process # Strip internal prefixes from all compiled contract JSONs in target directory # TODO: This should be part of bb aztec_process! for json in target/*.json; do - temp_file="${json}.tmp" - jq '.functions |= map(.name |= sub("^__aztec_nr_internals__"; ""))' "$json" > "$temp_file" - mv "$temp_file" "$json" + node -e ' + const fs = require("fs"); + const p = process.argv[2]; + const j = JSON.parse(fs.readFileSync(p, "utf8")); + j.functions = j.functions.map(f => ({ + ...f, + name: f.name.replace(/^__aztec_nr_internals__/, "") + })); + fs.writeFileSync(p, JSON.stringify(j)); + ' "$json" done echo "Compilation complete!" diff --git a/yarn-project/builder/package.json b/yarn-project/builder/package.json index f87a973dbf50..368e06ea5597 100644 --- a/yarn-project/builder/package.json +++ b/yarn-project/builder/package.json @@ -13,9 +13,6 @@ "name": "Aztec builder", "tsconfig": "./tsconfig.json" }, - "bin": { - "aztec-builder": "dest/bin/cli.js" - }, "scripts": { "build": "yarn clean && ../scripts/tsc.sh", "build:dev": "../scripts/tsc.sh --watch", diff --git a/yarn-project/yarn.lock b/yarn-project/yarn.lock index e0c025445479..7db141a4a903 100644 --- a/yarn-project/yarn.lock +++ b/yarn-project/yarn.lock @@ -792,8 +792,6 @@ __metadata: typescript: "npm:^5.3.3" viem: "npm:@aztec/viem@2.38.2" zod: "npm:^3.23.8" - bin: - aztec-faucet: ./dest/bin/index.js languageName: unknown linkType: soft @@ -836,8 +834,6 @@ __metadata: tslib: "npm:^2.4.0" typescript: "npm:^5.3.3" viem: "npm:@aztec/viem@2.38.2" - bin: - aztec-node: ./dest/bin/index.js languageName: unknown linkType: soft @@ -1100,8 +1096,6 @@ __metadata: jest: "npm:^30.0.0" ts-node: "npm:^10.9.1" typescript: "npm:^5.3.3" - bin: - aztec-builder: dest/bin/cli.js languageName: unknown linkType: soft