-
Notifications
You must be signed in to change notification settings - Fork 268
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into rk/no_sandbox_npm
- Loading branch information
Showing
679 changed files
with
7,605 additions
and
4,569 deletions.
There are no files selected for viewing
This file contains 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 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 +1 @@ | ||
v18.8.0 | ||
v18.19.0 |
This file contains 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,5 +1,5 @@ | ||
{ | ||
".": "0.16.1", | ||
"barretenberg": "0.16.1", | ||
"barretenberg/ts": "0.16.1" | ||
".": "0.16.7", | ||
"barretenberg": "0.16.7", | ||
"barretenberg/ts": "0.16.7" | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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,3 @@ | ||
.terraform | ||
.terraform* | ||
.DS_Store |
This file contains 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 @@ | ||
# The Aztec Installation Script | ||
|
||
``` | ||
bash -i <(curl -s install.aztec.network) | ||
``` | ||
|
||
That is all. | ||
|
||
This will install into `~/.aztec/bin` a collection of scripts to help running aztec containers, and will update | ||
a users `PATH` variable in their shell startup script so they can be found. | ||
|
||
- `aztec` - The infrastructure container. | ||
- `aztec-cli` - A command line tool for interacting with infrastructure. | ||
- `aztec-nargo` - A build of `nargo` from `noir` that is guaranteed to be version aligned. Provides compiler, lsp and more. | ||
- `aztec-sandbox` - A wrapper around docker-compose that launches services needed for sandbox testing. | ||
- `aztec-up` - A tool to upgrade the aztec toolchain to the latest, or specific versions. | ||
|
||
After installed, you can use `aztec-up` to upgrade or install specific versions. | ||
|
||
``` | ||
VERSION=master aztec-up | ||
``` | ||
|
||
This will install the container built from master branch. | ||
|
||
``` | ||
VERSION=v1.2.3 aztec-up | ||
``` | ||
|
||
This will install tagged release version 1.2.3. |
This file contains 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,84 @@ | ||
#!/usr/bin/env bash | ||
# The script starts a Docker container passing any commands and arguments to the command running inside the container. | ||
# It handles mounting paths into the container. | ||
# It handles networking comms back to the host. | ||
set -euo pipefail | ||
|
||
IMAGE=${1:-} | ||
shift | ||
|
||
VERSION=${VERSION:-"latest"} | ||
|
||
# Any host bindings we might send to the container. | ||
DOCKER_HOST_BINDS="" | ||
|
||
# Volumes to pass to the container. | ||
DOCKER_VOLUME="-v $HOME:/root" | ||
|
||
# Colors. | ||
y="\033[33m" | ||
r="\033[0m" | ||
|
||
function warn { | ||
echo -e "${y}$1${r}" | ||
} | ||
|
||
if ! command -v docker &> /dev/null; then | ||
warn "No docker found." | ||
exit 1 | ||
fi | ||
|
||
if [[ $PWD != ${HOME}* ]]; then | ||
warn "Due to how we containerize our applications, we require your working directory to be somewhere within $HOME." | ||
exit 1 | ||
fi | ||
|
||
# Set up host.docker.internal alias on Linux, just like it is on mac. | ||
UNAME=$(uname -s) | ||
if [ "$UNAME" == "Linux" ]; then | ||
if docker info 2>/dev/null | grep -q rootless; then | ||
# We're in rootless docker. Probe for the host ip and use that. | ||
ip=$(hostname -I | head | tr -d ' ') | ||
warn "WARNING: Running within rootless docker. Using $ip as host ip. Ensure listening services are listening on this interface." | ||
DOCKER_HOST_BINDS="$DOCKER_HOST_BINDS --add-host host.docker.internal:$ip" | ||
else | ||
DOCKER_HOST_BINDS="$DOCKER_HOST_BINDS --add-host host.docker.internal:host-gateway" | ||
fi | ||
fi | ||
|
||
# Substitute any references to localhost with our host gateway. | ||
# TODO: In node, we can hook the resolve override for localhost with host.docker.internal. | ||
# Consider if we should just do that, but that wouldn't help e.g. nargo. | ||
args=("$@") | ||
for i in "${!args[@]}"; do | ||
args[$i]=${args[$i]//localhost/host.docker.internal} | ||
done | ||
|
||
# Check if it's either a filename or a directory that exists outside the HOME. | ||
# If so, warn and exit. | ||
for i in "${!args[@]}"; do | ||
arg=${args[$i]} | ||
if [[ -f "$arg" || -d "$arg" && $(realpath $arg) != ${HOME}* ]]; then | ||
warn "Due to how we containerize our applications, paths outside of $HOME cannot be referenced." | ||
exit 1 | ||
fi | ||
done | ||
|
||
DOCKER_ENV="" | ||
for env in ${ENV_VARS_TO_INJECT:-}; do | ||
# First substitute any reference to localhost with our host gateway. | ||
env=${env//localhost/host.docker.internal} | ||
# Inject into container. | ||
DOCKER_ENV+="-e $env:${!env:-} " | ||
done | ||
|
||
DOCKER_VOLUME="$DOCKER_VOLUME -v cache:/cache" | ||
|
||
docker run \ | ||
-ti \ | ||
--rm \ | ||
--workdir "${PWD/$HOME/\/root}" \ | ||
$DOCKER_HOST_BINDS \ | ||
$DOCKER_ENV \ | ||
$DOCKER_VOLUME \ | ||
$IMAGE:$VERSION ${args[@]:-} |
This file contains 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,4 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
$(dirname $0)/.aztec-run aztecprotocol/aztec-sandbox $@ |
This file contains 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,9 @@ | ||
#!/usr/bin/env bash | ||
# TODO: Make compile command always be wasm. Or put nargo in container. Or probe. | ||
# TODO: Make unbox fail if trying to unbox outside of the cwd. | ||
set -euo pipefail | ||
|
||
export ENV_VARS_TO_INJECT="PXE_URL PRIVATE_KEY DEBUG" | ||
export PXE_URL=${PXE_URL:-"http://host.docker.internal:8080"} | ||
|
||
$(dirname $0)/.aztec-run aztecprotocol/cli $@ |
This file contains 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,163 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
# Colors | ||
g="\033[32m" # Green | ||
y="\033[33m" # Yellow | ||
b="\033[34m" # Blue | ||
p="\033[35m" # Purple | ||
r="\033[0m" # Reset | ||
bold="\033[1m" | ||
|
||
# Function to replace characters and add color | ||
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" | ||
} | ||
|
||
function title() { | ||
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 -e "We presently leverage docker to simplify releases of our complex project." | ||
echo -e "Please ensure it's installed for your platform: https://docs.docker.com/engine/install" | ||
echo | ||
if [ "$(uname -s)" == "Darwin" ]; then | ||
echo -e "${y}WARNING: For best performance we recommend adjusting your default docker settings:" | ||
echo -e " - Under general, enable VirtioFS." | ||
echo -e " - Under resources, set CPUs to ~80-100% your maximum." | ||
echo -e " - Under resources, set Memory to ~80% your maximum." | ||
echo -e "You may receive a warning about your home directory being mounted into a container." | ||
echo -e "This is requested so we can read and write project files, that is all." | ||
echo -e "${r}" | ||
fi | ||
echo -e "This will install the following scripts and update your PATH if necessary:" | ||
echo -e " ${bold}${g}aztec${r} - launches various infrastructure subsystems (sequencer, prover, pxe, etc)." | ||
echo -e " ${bold}${g}aztec-cli${r} - a command line tool for interfacing and experimenting with infrastructure." | ||
echo -e " ${bold}${g}aztec-nargo${r} - aztec's build of nargo, the noir compiler toolchain." | ||
echo -e " ${bold}${g}aztec-sandbox${r} - a wrapper around docker-compose that launches services needed for sandbox testing." | ||
echo -e " ${bold}${g}aztec-up${r} - a tool to upgrade the aztec toolchain to the latest, or specific versions." | ||
echo | ||
read -p "Do you wish to continue? (y/n)" -n 1 -r | ||
echo | ||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then | ||
exit 0 | ||
fi | ||
} | ||
|
||
function info { | ||
echo -e "${g}$1${r}" | ||
} | ||
|
||
function warn { | ||
echo -e "${y}$1${r}" | ||
} | ||
|
||
AZTEC_PATH=$HOME/.aztec | ||
BIN_PATH=$AZTEC_PATH/bin | ||
|
||
# Define version if specified, otherwise set to "latest". | ||
VERSION=${VERSION:-"latest"} | ||
INSTALL_HOST=install.aztec.network.s3-website.eu-west-2.amazonaws.com | ||
|
||
[ -z "${SKIP_TITLE:-}" ] && title | ||
|
||
# Check if Docker is available. | ||
if ! command -v docker &>/dev/null; then | ||
warn "Docker is not installed. Please install Docker and try again." | ||
exit 1 | ||
fi | ||
|
||
# Check if Docker is running. | ||
if ! docker info &>/dev/null; then | ||
warn "Docker is not running. Please start Docker and try again." | ||
exit 1 | ||
fi | ||
|
||
if ! docker compose &>/dev/null && ! command -v docker-compose &>/dev/null; then | ||
warn "WARNING: 'docker compose' not supported and docker-compose not found." | ||
warn "Continuing installation, but aztec-sandbox will not work." | ||
fi | ||
|
||
# Create a "hidden" `$HOME/.aztec` dir, so as not to clutter the user's cwd. | ||
rm -f $BIN_PATH/* && mkdir -p $BIN_PATH | ||
|
||
# Download containers from dockerhub. Tag them as latest. | ||
function pull_container { | ||
docker pull aztecprotocol/$1:$VERSION | ||
|
||
# If not latest, retag to be latest so it runs from scripts. | ||
if [ $VERSION != "latest" ]; then | ||
docker tag aztecprotocol/$1:$VERSION aztecprotocol/$1:latest | ||
fi | ||
} | ||
|
||
if [ -z "${SKIP_PULL:-}" ]; then | ||
info "Pulling aztec version $VERSION..." | ||
pull_container aztec-sandbox | ||
pull_container cli | ||
pull_container noir | ||
fi | ||
|
||
# Download the Docker Compose file. Used by aztec-start. | ||
curl -fsSL http://$INSTALL_HOST/docker-compose.yml -o $BIN_PATH/docker-compose.yml | ||
|
||
function install_bin { | ||
curl -fsSL http://$INSTALL_HOST/$1 -o $BIN_PATH/$1 | ||
chmod +x $BIN_PATH/$1 | ||
echo "Installed: $BIN_PATH/$1" | ||
} | ||
|
||
info "Installing scripts in $BIN_PATH..." | ||
install_bin .aztec-run | ||
install_bin aztec | ||
install_bin aztec-cli | ||
install_bin aztec-sandbox | ||
install_bin aztec-up | ||
install_bin aztec-nargo | ||
|
||
function update_path_env_var { | ||
TARGET_DIR="${1}" | ||
# Check if the target directory is in the user's PATH. | ||
if [[ ":$PATH:" != *":$TARGET_DIR:"* ]]; then | ||
# Determine the user's shell. | ||
SHELL_PROFILE="" | ||
case $SHELL in | ||
*/bash) | ||
SHELL_PROFILE="$HOME/.bashrc" | ||
;; | ||
*/zsh) | ||
SHELL_PROFILE="$HOME/.zshrc" | ||
;; | ||
# Add other shells as needed | ||
*) | ||
echo "Unsupported shell: $SHELL" | ||
return | ||
;; | ||
esac | ||
# Inform the user about the change and ask for confirmation | ||
warn "The directory $TARGET_DIR is not in your PATH." | ||
read -p "Add it to $SHELL_PROFILE to make the aztec binaries accessible? (y/n)" -n 1 -r | ||
echo | ||
if [[ $REPLY =~ ^[Yy]$ ]]; then | ||
# Add the target directory to the user's PATH in their profile. | ||
echo "export PATH=\$PATH:$TARGET_DIR" >> "$SHELL_PROFILE" | ||
info "Done! Starting fresh shell..." | ||
$SHELL | ||
else | ||
warn "Skipped updating PATH. You might need to add $TARGET_DIR to your PATH manually to use the binary." | ||
fi | ||
fi | ||
} | ||
|
||
update_path_env_var $BIN_PATH | ||
|
||
info "Done!" |
This file contains 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,4 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
$(dirname $0)/.aztec-run aztecprotocol/noir $@ |
This file contains 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,21 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
# Favour 'docker compose', falling back on docker-compose. | ||
CMD="docker compose" | ||
$CMD &>/dev/null || CMD="docker-compose" | ||
|
||
ARGS="-f $HOME/.aztec/bin/docker-compose.yml -p sandbox" | ||
|
||
# Function to be executed when SIGINT is received. | ||
cleanup() { | ||
$CMD $ARGS down | ||
} | ||
|
||
# Set trap to catch SIGINT and call the cleanup function. | ||
trap cleanup SIGINT | ||
|
||
# Change working dir, so relative volume mounts are in the right place. | ||
cd ~/.aztec | ||
|
||
$CMD $ARGS up --force-recreate --remove-orphans |
This file contains 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,5 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
export SKIP_TITLE=1 | ||
bash -i <(curl -s http://install.aztec.network) |
Oops, something went wrong.