-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into janb/field-note
- Loading branch information
Showing
27 changed files
with
517 additions
and
118 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 |
---|---|---|
|
@@ -3,6 +3,9 @@ sol/cache | |
sol/out | ||
sol/Dockerfile | ||
sol/lib | ||
sol/.foundry | ||
sol/cache | ||
sol/out | ||
cpp/build | ||
cpp/srs_db/ignition | ||
.gitmodules |
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 |
---|---|---|
|
@@ -12,4 +12,4 @@ out/ | |
.vscode/settings.json | ||
.foundry | ||
|
||
build/ | ||
**/build*/* |
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,7 @@ | ||
^barretenberg/cpp/.*\.(cpp|cc|cxx|c\+\+|h|hpp|hxx|h\+\+|c|h|inl|inc|ipp|tpp|cmake)$ | ||
^barretenberg/cpp/.*CMakeLists\.txt$ | ||
^barretenberg/cpp/.*Dockerfile.*$ | ||
^barretenberg/cpp/scripts/ | ||
^barretenberg/sol/src/ | ||
^barretenberg/sol/scripts/ | ||
^barretenberg/sol/test/ |
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
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,18 @@ | ||
FROM ubuntu:focal | ||
|
||
# Install nginx | ||
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections | ||
RUN apt-get update && apt install -y git curl nginx | ||
|
||
# Copy nginx config | ||
COPY . . | ||
COPY nginx/gateway.conf /etc/nginx/gateway.conf | ||
COPY nginx/nginx.conf /etc/nginx/nginx.conf | ||
|
||
# Install foundry | ||
RUN ./scripts/install_foundry.sh | ||
ENV PATH="./foundry/bin:${PATH}" | ||
|
||
# Run anvil and nginx | ||
EXPOSE 80 | ||
ENTRYPOINT ["sh", "-c", "./scripts/run_nginx_anvil.sh"] |
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,14 @@ | ||
server { | ||
listen 80 default_server; | ||
listen 8545; | ||
|
||
location = /{{API_KEY}} { | ||
proxy_pass http://0.0.0.0:8544; | ||
rewrite ^/{{API_KEY}}(.*) /$1 break; | ||
} | ||
|
||
# Error responses | ||
error_page 404 = @400; # Treat invalid paths as bad requests | ||
proxy_intercept_errors on; # Do not send backend errors to client | ||
default_type application/json; # If no content-type, assume JSON | ||
} |
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,53 @@ | ||
|
||
events { | ||
worker_connections 768; | ||
# multi_accept on; | ||
} | ||
|
||
http { | ||
|
||
## | ||
# Basic Settings | ||
## | ||
|
||
sendfile on; | ||
tcp_nopush on; | ||
tcp_nodelay on; | ||
keepalive_timeout 65; | ||
types_hash_max_size 2048; | ||
|
||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
## | ||
# SSL Settings | ||
## | ||
|
||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE | ||
ssl_prefer_server_ciphers on; | ||
|
||
## | ||
# Logging Settings | ||
## | ||
|
||
access_log /var/log/nginx/access.log; | ||
error_log /var/log/nginx/error.log; | ||
|
||
## | ||
# Gzip Settings | ||
## | ||
|
||
gzip on; | ||
|
||
# gzip_vary on; | ||
# gzip_proxied any; | ||
# gzip_comp_level 6; | ||
# gzip_buffers 16 8k; | ||
# gzip_http_version 1.1; | ||
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; | ||
|
||
|
||
include /etc/nginx/gateway.conf; | ||
include /etc/nginx/conf.d/*.conf; | ||
} | ||
|
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 @@ | ||
#!/bin/sh | ||
set -eu | ||
|
||
export FOUNDRY_DIR="$PWD/.foundry" | ||
FOUNDRY_BIN_DIR="$FOUNDRY_DIR/bin" | ||
BIN_URL="https://raw.githubusercontent.com/foundry-rs/foundry/master/foundryup/foundryup" | ||
BIN_PATH="$FOUNDRY_BIN_DIR/foundryup" | ||
FOUNDRY_MAN_DIR="$FOUNDRY_DIR/share/man/man1" | ||
|
||
# Clean | ||
rm -rf $FOUNDRY_DIR | ||
|
||
# Install foundryup. | ||
mkdir -p $FOUNDRY_BIN_DIR | ||
mkdir -p $FOUNDRY_MAN_DIR | ||
curl -# -L $BIN_URL -o $BIN_PATH | ||
chmod +x $BIN_PATH | ||
export PATH=$FOUNDRY_BIN_DIR:$PATH | ||
|
||
# Use version. | ||
foundryup |
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,28 @@ | ||
#!/bin/bash | ||
|
||
set -eum pipefail | ||
|
||
# Replace API_KEY in nginx config | ||
echo "Replacing api key with $API_KEY in nginx config..." | ||
sed -i 's/{{API_KEY}}/'$API_KEY'/' /etc/nginx/gateway.conf | ||
|
||
# Run nginx and anvil alongside each other | ||
trap 'kill $(jobs -p)' SIGTERM | ||
|
||
# Anvil defaults - Nginx assumes these values to be as they are | ||
HOST="0.0.0.0" | ||
PORT=8544 | ||
ETHEREUM_HOST=$HOST:$PORT | ||
|
||
# Data directory for anvil state | ||
mkdir -p /data | ||
|
||
# Run anvil silently | ||
.foundry/bin/anvil --silent --host $HOST -p $PORT -m "$MNEMONIC" -f=https://mainnet.infura.io/v3/$INFURA_API_KEY --chain-id=$CHAIN_ID --fork-block-number=15918000 --block-base-fee-per-gas=10 -s=$SNAPSHOT_FREQUENCY --state=./data/state --balance=1000000000000000000 >/dev/null & | ||
|
||
echo "Waiting for ethereum host at $ETHEREUM_HOST..." | ||
while ! curl -s $ETHEREUM_HOST >/dev/null; do sleep 1; done | ||
|
||
echo "Starting nginx..." | ||
nginx & | ||
wait |
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,15 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# When destroying and applying mainnet fork terraform, it may not be | ||
# ready for a while, as it must register with DNS etc. | ||
# This script waits on a healthy status from the fork - a valid response to the chainid request | ||
# We retry every 20 seconds, and wait for a total of 5 minutes (15 times) | ||
|
||
export ETHEREUM_HOST="https://aztec-mainnet-fork.aztec.network:8545/$FORK_API_KEY" | ||
|
||
curl -H "Content-Type: application/json" -X POST --data '{"method":"eth_chainId","params":[],"id":33,"jsonrpc":"2.0"}' \ | ||
--connect-timeout 30 \ | ||
--retry 15 \ | ||
--retry-delay 20 \ | ||
$ETHEREUM_HOST |
Oops, something went wrong.