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
28 changes: 28 additions & 0 deletions aztec-up/bin/0.0.1/aztec-banner

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions aztec-up/bin/0.0.1/aztec-banner-truecolor

Large diffs are not rendered by default.

86 changes: 57 additions & 29 deletions aztec-up/bin/0.0.1/aztec-install
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
# or: VERSION=0.85.0 bash -i <(curl -s https://install.aztec.network)
set -euo pipefail

# Colors
g="\033[32m" # Green
y="\033[33m" # Yellow
b="\033[34m" # Blue
p="\033[35m" # Purple
# Colors (truecolor with 256-color fallback)
r="\033[0m" # Reset
bold="\033[1m"
g="\033[38;5;114m" # green
y="\033[38;5;222m" # yellow
b="\033[38;5;111m" # blue
p="\033[38;5;176m" # purple
red="\033[38;5;203m" # red
o="\033[38;5;214m" # orange

if [ ! -t 0 ]; then
NON_INTERACTIVE=1
Expand All @@ -23,40 +25,66 @@ fi
AZTEC_HOME="${AZTEC_HOME:-$HOME/.aztec}"
shared_bin_path="$AZTEC_HOME/bin"

VERSION="${VERSION:-nightly}"
VERSION=${VERSION:-0.0.1}

# Install URI (root, not version-specific)
INSTALL_URI="${INSTALL_URI:-https://install.aztec-labs.com}"

# Add color to the AZTEC ascii art.
function print_colored() {
local b=$'\033[34m' # Blue
local y=$'\033[33m' # Yellow
local r=$'\033[0m' # Reset
echo "$1" | sed -E "s/(█+)/${b}\1${y}/g"
# Resolve alias (like "nightly") to actual version number.
function resolve_version {
local version="$1"
local semver_regex='^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?(\+[a-zA-Z0-9.]+)?$'
if [[ "$version" =~ $semver_regex ]]; then
echo "$version"
else
local resolved
if ! resolved=$(curl -fsSL "$INSTALL_URI/aliases/$version" 2>/dev/null); then
echo "Error: Could not resolve alias '$version'" >&2
exit 1
fi
echo "$resolved"
fi
}

VERSION=$(resolve_version "$VERSION")

function typewriter {
trap 'printf "${r}\n"; exit 1' INT
local text="$1"
local color="${2:-}"
local delay="${3:-0.02}"
local width=80
local pad=$(( (width - ${#text}) / 2 ))
printf "\r\033[2K%${pad}s${color}" ""
for (( i=0; i<${#text}; i++ )); do printf '%s' "${text:$i:1}"; sleep "$delay"; done
trap - INT
}

function title {
clear
if [ "${COLORTERM:-}" = "truecolor" ] || [ "${COLORTERM:-}" = "24bit" ]; then
curl -fsSL "$INSTALL_URI/$VERSION/aztec-banner-truecolor" 2>/dev/null || true
else
curl -fsSL "$INSTALL_URI/$VERSION/aztec-banner" 2>/dev/null || true
fi
typewriter "initializing stealth protocols..." "${p}"
sleep 1
typewriter "zk loaded." "${y}"
sleep 1
typewriter "privacy restored." "${g}${bold}"
sleep 1
printf "${r}\r"
echo -e "Welcome to ${bold}${b}Aztec${r}! Your journey into blockchain privacy begins... ${bold}${p}now${r}."
echo
print_colored " █████╗ ███████╗████████╗███████╗ ██████╗"
print_colored "██╔══██╗╚══███╔╝╚══██╔══╝██╔════╝██╔════╝"
print_colored "███████║ ███╔╝ ██║ █████╗ ██║"
print_colored "██╔══██║ ███╔╝ ██║ ██╔══╝ ██║"
print_colored "██║ ██║███████╗ ██║ ███████╗╚██████╗"
print_colored "╚═╝ ╚═╝╚══════╝ ╚═╝ ╚══════╝ ╚═════╝"
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 -e "Installing version: ${bold}${o}$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}noir-profiler${r} - a sampling profiler for analyzing and visualizing Noir programs."
echo -e " ${bold}${g}bb${r} - the version of the barretenberg proving backend compatible with this version of aztec."
echo -e " ${bold}${g}aztec${r} - a collection of tools to compile and test contracts, to launch subsystems and interact with the aztec network."
echo -e " ${bold}${g}aztec-up${r} - a tool to install and manage aztec toolchain versions."
echo -e " ${bold}${g}aztec-wallet${r} - our minimalistic CLI wallet"
echo -e "This script installs the following and updates your PATH if necessary:"
echo -e " ${bold}${g}nargo${r} - the noir programming language compiler and simulator."
echo -e " ${bold}${g}noir-profiler${r} - a profiler for analyzing and visualizing noir programs."
echo -e " ${bold}${g}bb${r} - the barretenberg proving backend."
echo -e " ${bold}${g}aztec${r} - compiles and tests contracts, interacts with the network."
echo -e " ${bold}${g}aztec-up${r} - installs and manages aztec toolchain versions."
echo -e " ${bold}${g}aztec-wallet${r} - a minimalistic wallet cli."
echo
read -p "Do you wish to continue? (y/n) " -n 1 -r
echo
Expand Down
67 changes: 65 additions & 2 deletions aztec-up/bin/0.0.1/aztec-up
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function help {
echo " use [<version>] Switch to an installed version (or read from .aztecrc)"
echo " list List installed versions"
echo " uninstall <version> Remove an installed version"
echo " prune Remove all versions except the current one"
echo " self-update Update aztec-up itself to the latest version"
echo " env Output PATH for .aztecrc version (for eval)"
echo
Expand Down Expand Up @@ -159,7 +160,7 @@ function cmd_install {
fi

# Download and run the version-specific installer
curl -fsSL "$install_url" | VERSION="$resolved_version" bash
curl -fsSL "$install_url" | bash

# Update the current symlink
ln -sfn "$AZTEC_HOME/versions/$resolved_version" "$AZTEC_HOME/current"
Expand Down Expand Up @@ -328,6 +329,68 @@ function cmd_uninstall {
echo_green "Uninstalled version $version"
}

# Remove all versions except the current one
function cmd_prune {
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
echo "Remove all installed versions except the currently active one"
echo
echo "Usage: aztec-up prune"
echo
echo "Options:"
echo " -h, --help Print help"
echo
echo "Examples:"
echo " aztec-up prune # Remove all versions except current"
return 0
fi

local current_version
current_version=$(get_current_version)

if [ -z "$current_version" ]; then
echo "Error: No version is currently active. Use 'aztec-up use <version>' first."
exit 1
fi

# Collect versions to remove
local to_remove=()
for dir in "$AZTEC_HOME/versions"/*/; do
[ -d "$dir" ] || continue
local version
version=$(basename "$dir")
if [ "$version" != "$current_version" ]; then
to_remove+=("$version")
fi
done

if [ ${#to_remove[@]} -eq 0 ]; then
echo "Nothing to prune. Only the current version ($current_version) is installed."
return 0
fi

echo "Current version: $current_version"
echo
echo "The following versions will be removed:"
for version in "${to_remove[@]}"; do
echo " $version"
done
echo

read -p "Continue? (y/n) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Aborted."
return 0
fi

for version in "${to_remove[@]}"; do
rm -rf "$AZTEC_HOME/versions/$version"
echo "Removed $version"
done

echo_green "Pruned all versions except $current_version"
}

# Update aztec-up itself
function cmd_self-update {
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
Expand Down Expand Up @@ -417,7 +480,7 @@ function main {
""|-h|--help)
help
;;
install|use|list|uninstall|self-update|env)
install|use|list|uninstall|prune|self-update|env)
cmd_$cmd "$@"
;;
*)
Expand Down
15 changes: 8 additions & 7 deletions aztec-up/bin/0.0.1/install
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
set -euo pipefail

# Colors
r="\033[31m" # Red
g="\033[32m" # Green
y="\033[33m" # Yellow
b="\033[34m" # Blue
reset="\033[0m"
g="\033[38;5;114m" # green
y="\033[38;5;222m" # yellow
b="\033[38;5;111m" # blue
p="\033[38;5;176m" # purple
r="\033[38;5;203m" # red

# Helper function to safely read version from versions file
function get_version {
Expand All @@ -24,7 +25,7 @@ function get_version {
}

# Required environment variables
VERSION="${VERSION:?VERSION must be set}"
VERSION=0.0.1
AZTEC_HOME="${AZTEC_HOME:-$HOME/.aztec}"
INSTALL_URI="${INSTALL_URI:-https://install.aztec-labs.com}"

Expand Down Expand Up @@ -211,8 +212,8 @@ function main {
dump_fail install_node
echo_green "done."

# Source nvm to ensure node is in PATH.
. "$HOME/.nvm/nvm.sh"
# Source nvm to ensure node is in PATH (if using nvm).
[ -f "$HOME/.nvm/nvm.sh" ] && . "$HOME/.nvm/nvm.sh"

# Install noir
echo -n "Installing nargo... "
Expand Down
22 changes: 11 additions & 11 deletions aztec-up/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,22 +109,23 @@ function release {
echo_header "aztec-up release"
local version=${REF_NAME#v}

# Upload version-specific files to version directory.
do_or_dryrun aws s3 cp bin/0.0.1/install "s3://install.aztec.network/$version/install"
do_or_dryrun aws s3 cp bin/0.0.1/versions "s3://install.aztec.network/$version/versions"
do_or_dryrun aws s3 cp bin/0.0.1/aztec-install "s3://install.aztec.network/$version/aztec-install"
do_or_dryrun aws s3 cp bin/0.0.1/aztec-up "s3://install.aztec.network/$version/aztec-up"
# Upload each file in bin/0.0.1/, replacing VERSION= lines with the release version.
for file in bin/0.0.1/*; do
sed "s/^VERSION=.*/VERSION=$version/" "$file" | \
do_or_dryrun aws s3 cp - "s3://install.aztec.network/$version/$(basename $file)"
done

# Update alias to point to new version.
# This has real impact outside of the version fence. i.e. if it's nightly dist tag, it affects nightly installs.
# This has real impact outside of the version fence. i.e. if it's a nightly dist tag, it affects nightly installs.
do_or_dryrun aws s3 cp - "s3://install.aztec.network/aliases/$(dist_tag)" <<< "$version"
}

# This is not done by CI.
# It's a manual process, as updating the root installer and alias index requires careful consideration.
function release_aztec_up {
# Update root scripts.
do_or_dryrun aws s3 cp bin/0.0.1/aztec-install "s3://install.aztec.network/aztec-install"
function release_root_installer {
# Upload root aztec-install with VERSION defaulting to nightly (instead of local 0.0.1).
sed "s/^VERSION=.*/VERSION=\${VERSION:-nightly}/" bin/0.0.1/aztec-install | \
do_or_dryrun aws s3 cp - "s3://install.aztec.network/aztec-install"
do_or_dryrun aws s3 cp bin/0.0.1/aztec-up "s3://install.aztec.network/aztec-up"

# Update alias list.
Expand Down Expand Up @@ -198,15 +199,14 @@ function install_on_mac_vm {
export npm_config_registry=http://$host_ip:$verdaccio_port
export INSTALL_URI=http://$host_ip:$http_port
export NO_NEW_SHELL=1
export NON_INTERACTIVE=1

touch \$HOME/.zshrc
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash
. "\$HOME/.nvm/nvm.sh"

echo
echo "Running aztec install script..."
VERSION=0.0.1 bash <(curl -sL \$INSTALL_URI/0.0.1/aztec-install)
bash <(curl -sL \$INSTALL_URI/0.0.1/aztec-install)

# Fake fresh shell.
export PATH="\$HOME/.aztec/current/bin:\$HOME/.aztec/current/node_modules/.bin:\$HOME/.aztec/bin:\$PATH"
Expand Down
Loading