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
5 changes: 2 additions & 3 deletions iac/network/common/gcp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ module "iam" {
}

module "firewall" {
source = "../../modules/firewall/gcp"
p2p_tcp_ports = var.p2p_ports
p2p_udp_ports = var.p2p_ports
source = "../../modules/firewall/gcp"
p2p_ports = var.p2p_ports
}
9 changes: 8 additions & 1 deletion spartan/aztec-network/files/config/deploy-l1-contracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,27 @@ fi
output=""
MAX_RETRIES=5
RETRY_DELAY=15

TEST_ACCOUNTS=${TEST_ACCOUNTS:-false}
TEST_ACCOUNTS_ARG=""
if [ "$TEST_ACCOUNTS" = "true" ]; then
TEST_ACCOUNTS_ARG="--test-accounts"
fi

SPONSORED_FPC=${SPONSORED_FPC:-false}
SPONSORED_FPC_ARG=""
if [ "$SPONSORED_FPC" = "true" ]; then
SPONSORED_FPC_ARG="--sponsored-fpc"
fi

ACCELERATED_TEST_DEPLOYMENTS_ARG=""
if [ "$ACCELERATED_TEST_DEPLOYMENTS" = "true" ]; then
ACCELERATED_TEST_DEPLOYMENTS_ARG="--accelerated-test-deployments"
fi

for attempt in $(seq 1 $MAX_RETRIES); do
# Construct base command
base_cmd="LOG_LEVEL=debug node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts $TEST_ACCOUNTS_ARG $ACCELERATED_TEST_DEPLOYMENTS_ARG"
base_cmd="LOG_LEVEL=debug node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts $TEST_ACCOUNTS_ARG $ACCELERATED_TEST_DEPLOYMENTS_ARG $SPONSORED_FPC_ARG"

# Add account - use private key if set, otherwise use mnemonic
if [ -n "${L1_DEPLOYMENT_PRIVATE_KEY:-}" ]; then
Expand Down
2 changes: 2 additions & 0 deletions spartan/aztec-network/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ Combined wait-for-services and configure-env container for full nodes
value: "{{ .Values.aztec.contracts.registryAddress }}"
- name: SLASH_FACTORY_CONTRACT_ADDRESS
value: "{{ .Values.aztec.contracts.slashFactoryAddress }}"
- name: FEE_ASSET_HANDLER_CONTRACT_ADDRESS
value: "{{ .Values.aztec.contracts.feeAssetHandlerContractAddress }}"
{{- end -}}

{{/*
Expand Down
5 changes: 5 additions & 0 deletions spartan/aztec-network/templates/blob-sink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ spec:
{{- if .Values.storage.localSsd }}
{{- include "aztec-network.gcpLocalSsd" . | nindent 6 }}
{{- end }}
{{- if .Values.network.public }}
serviceAccountName: {{ include "aztec-network.fullname" . }}-node
{{- end }}
dnsPolicy: ClusterFirstWithHostNet
initContainers:
{{- include "aztec-network.serviceAddressSetupContainer" . | nindent 8 }}
Expand Down Expand Up @@ -80,6 +83,8 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: ROLLUP_CONTRACT_ADDRESS
value: "{{ .Values.aztec.contracts.rollupAddress }}"
- name: BLOB_SINK_PORT
value: "{{ .Values.blobSink.service.nodePort }}"
- name: LOG_LEVEL
Expand Down
4 changes: 4 additions & 0 deletions spartan/aztec-network/templates/boot-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ spec:
value: "{{ .Values.ethereum.acceleratedTestDeployments }}"
- name: TEST_ACCOUNTS
value: "{{ .Values.aztec.testAccounts }}"
- name: SPONSORED_FPC
value: "{{ .Values.aztec.sponsoredFPC }}"
- name: REGISTRY_CONTRACT_ADDRESS
value: "{{ .Values.bootNode.contracts.registryAddress }}"
- name: TELEMETRY
Expand Down Expand Up @@ -230,6 +232,8 @@ spec:
value: "{{ .Values.telemetry.excludeMetrics }}"
- name: TEST_ACCOUNTS
value: "{{ .Values.aztec.testAccounts }}"
- name: SPONSORED_FPC
value: "{{ .Values.aztec.sponsoredFPC }}"
{{- if .Values.blobSink.enabled }}
- name: BLOB_SINK_URL
value: {{ include "aztec-network.blobSinkUrl" . }}
Expand Down
2 changes: 2 additions & 0 deletions spartan/aztec-network/templates/full-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ spec:
value: "{{ .Values.network.p2pBootstrapNodesAsFullPeers }}"
- name: TEST_ACCOUNTS
value: "{{ .Values.aztec.testAccounts }}"
- name: SPONSORED_FPC
value: "{{ .Values.aztec.sponsoredFPC }}"
{{- if .Values.blobSink.enabled }}
- name: BLOB_SINK_URL
value: {{ include "aztec-network.blobSinkUrl" . }}
Expand Down
2 changes: 2 additions & 0 deletions spartan/aztec-network/templates/prover-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ spec:
value: "{{ .Values.telemetry.excludeMetrics }}"
- name: TEST_ACCOUNTS
value: "{{ .Values.aztec.testAccounts }}"
- name: SPONSORED_FPC
value: "{{ .Values.aztec.sponsoredFPC }}"
{{- if .Values.blobSink.enabled }}
- name: BLOB_SINK_URL
value: {{ include "aztec-network.blobSinkUrl" . }}
Expand Down
21 changes: 20 additions & 1 deletion spartan/aztec-network/templates/setup-l2-contracts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,22 @@ spec:
done
echo "PXE service is ready!"
set -e
LOG_LEVEL=debug node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js setup-protocol-contracts --skipProofWait
export LOG_LEVEL=debug

TEST_ACCOUNTS=${TEST_ACCOUNTS:-false}
TEST_ACCOUNTS_ARG=""
if [ "$TEST_ACCOUNTS" = "true" ]; then
TEST_ACCOUNTS_ARG="--testAccounts"
fi

SPONSORED_FPC=${SPONSORED_FPC:-false}
SPONSORED_FPC_ARG=""
if [ "$SPONSORED_FPC" = "true" ]; then
SPONSORED_FPC_ARG="--sponsoredFPC"
fi

node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js setup-protocol-contracts --skipProofWait $TEST_ACCOUNTS_ARG $SPONSORED_FPC_ARG

echo "L2 contracts initialized"
env:
- name: K8S_POD_UID
Expand All @@ -80,6 +95,10 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: TEST_ACCOUNTS
value: "{{ .Values.aztec.testAccounts }}"
- name: SPONSORED_FPC
value: "{{ .Values.aztec.sponsoredFPC }}"
- name: TELEMETRY
value: "{{ .Values.telemetry.enabled }}"
- name: LOG_LEVEL
Expand Down
2 changes: 2 additions & 0 deletions spartan/aztec-network/templates/validator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ spec:
value: "{{ .Values.telemetry.excludeMetrics }}"
- name: TEST_ACCOUNTS
value: "{{ .Values.aztec.testAccounts }}"
- name: SPONSORED_FPC
value: "{{ .Values.aztec.sponsoredFPC }}"
- name: P2P_BOOTSTRAP_NODES_AS_FULL_PEERS
value: "{{ .Values.network.p2pBootstrapNodesAsFullPeers }}"
{{- if .Values.blobSink.enabled }}
Expand Down
3 changes: 3 additions & 0 deletions spartan/aztec-network/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ aztec:
contracts:
registryAddress: ""
slashFactoryAddress: ""
rollupAddress: "" # only needed for blob sink
feeAssetHandlerContractAddress: ""

slotDuration: 36 # in seconds, aka L2 slot duration. Must be a multiple of {{ ethereum.blockTime }}
epochDuration: 32 # how many L2 slots in an epoch
Expand All @@ -59,6 +61,7 @@ aztec:

l1Salt: "" # leave empty for random salt
testAccounts: true
sponsoredFPC: false
l1DeploymentMnemonic: "test test test test test test test test test test test junk" # the mnemonic used when deploying contracts
manaTarget: "" # use default value

Expand Down
88 changes: 88 additions & 0 deletions spartan/aztec-network/values/alpha-testnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
telemetry:
enabled: true

aztec:
realProofs: true
numberOfDefaultAccounts: 0
testAccounts: true
sponsoredFPC: false
bootstrapENRs: "enr:-LO4QLbJddVpePYjaiCftOBY-L7O6Mfj_43TAn5Q1Y-5qQ_OWmSFc7bTKWHzw5xmdVIqXUiizum_kIRniXdPnWHHcwEEhWF6dGVjqDAwLTExMTU1MTExLTAwMDAwMDAwLTAtMTgwNmEwMjgtMWE1MzBmM2KCaWSCdjSCaXCEI8nh9YlzZWNwMjU2azGhA-_dX6aFcXP1DLk91negbXL2a0mNYGXH4hrMvb2i92I0g3VkcIKd0A,enr:-LO4QN4WF8kFyV3sQVX0C_y_03Eepxk5Wac70l9QJcIDRYwKS6aRst1YcfbTDdvovXdRfKf-WSXNVWViGLhDA-dUz2MEhWF6dGVjqDAwLTExMTU1MTExLTAwMDAwMDAwLTAtMTgwNmEwMjgtMWE1MzBmM2KCaWSCdjSCaXCEIicTHolzZWNwMjU2azGhAsz7aFFYRnP5xjTux5UW-HyEQcW_EJrZMT1CNm79N4g-g3VkcIKd0A,enr:-LO4QFrGfkRaCk_iFTeUjR5ESwo45Eov9hx_T1-BLdoT-iHzFgCiHMT4V1KBtdFp8D0ajLSe5HcNYrhalmdJXgv6NTUEhWF6dGVjqDAwLTExMTU1MTExLTAwMDAwMDAwLTAtMTgwNmEwMjgtMWE1MzBmM2KCaWSCdjSCaXCEIlICt4lzZWNwMjU2azGhAlC6nKB3iDtRFqWKWqxf_t-P9hc-SZ6VFBJV4y3bTZBQg3VkcIKd0A"
contracts:
registryAddress: "0xad85d55a4bbef35e95396191c22903aa717edf1c"
rollupAddress: "0x8e9152bb1b0577ea82508c001785e92fc96035fd"
slashFactoryAddress: "0xf667f50fd68b30c38b12d29fee537fa5ea158eb8"
feeAssetHandlerContractAddress: "0xf0664fec6ac15313e18d5ad8225e46b7c6463338"

network:
public: true
setupL2Contracts: false
p2pBootstrapNodesAsFullPeers: false

blobSink:
enabled: true
dataStoreConfig:
dataDir: "/data"
storageSize: "128Gi"
dataStoreMapSize: "134217728" # 128 GB

bot:
enabled: false

pxe:
enabled: false

faucet:
enabled: false

bootNode:
enabled: false
# unused.
externalHost: "http://localhost:8080"

proverNode:
l1FixedPriorityFeePerGas: 3
l1GasLimitBufferPercentage: 15
l1GasPriceMax: 1000
maxOldSpaceSize: "8192"
storageSize: "512Gi"
resources:
requests:
cpu: "3"
memory: "10Gi"

validator:
replicas: 3
l1FixedPriorityFeePerGas: 3
l1GasLimitBufferPercentage: 15
l1GasPriceMax: 1000
storageSize: "512Gi"
sequencer:
minTxsPerBlock: 0
maxTxsPerBlock: 4
validator:
disabled: false
maxOldSpaceSize: "8192"
resources:
requests:
cpu: "3"
memory: "10Gi"

proverAgent:
replicas: 32
bb:
hardwareConcurrency: 31
gke:
spotEnabled: true
resources:
requests:
memory: "116Gi"
cpu: "31"

ethereum:
chainId: "11155111"
l1GasPriceMax: 1000
l1FixedPriorityFeePerGas: 3

jobs:
deployL1Verifier:
enable: false
2 changes: 2 additions & 0 deletions spartan/aztec-network/values/rc-1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ aztec:
epochDuration: 32
proofSubmissionWindow: 64
realProofs: true
testAccounts: true
sponsoredFPC: true

images:
aztec:
Expand Down
38 changes: 20 additions & 18 deletions spartan/scripts/prepare_sepolia_accounts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,26 @@ eth_amount=${2:-"1"}
output_file=${3:-"mnemonic.tmp"}
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-"$HOME/.config"}

# Install bc if needed
if ! command -v bc &>/dev/null; then
echo "Installing bc..."
apt-get update && apt-get install -y bc
fi

# Install cast if needed
if ! command -v cast &>/dev/null; then
echo "Installing cast..."
curl -L https://foundry.paradigm.xyz | bash
$HOME/.foundry/bin/foundryup && export PATH="$PATH:$HOME/.foundry/bin" || $XDG_CONFIG_HOME/.foundry/bin/foundryup && export PATH="$PATH:$XDG_CONFIG_HOME/.foundry/bin"
fi

# Install yq if needed
if ! command -v yq &>/dev/null; then
echo "Installing yq..."
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/local/bin/yq
chmod +x /usr/local/bin/yq
fi

# Convert ETH to wei
wei_amount=$(cast to-wei "$eth_amount" ether)

Expand Down Expand Up @@ -59,25 +79,7 @@ max_index=$((max_index > bot_max_index ? max_index : bot_max_index))
# Total number of accounts needed
total_accounts=$((num_validators + num_provers + num_bots))

# Install bc if needed
if ! command -v bc &>/dev/null; then
echo "Installing bc..."
apt-get update && apt-get install -y bc
fi

# Install cast if needed
if ! command -v cast &>/dev/null; then
echo "Installing cast..."
curl -L https://foundry.paradigm.xyz | bash
$HOME/.foundry/bin/foundryup && export PATH="$PATH:$HOME/.foundry/bin" || $XDG_CONFIG_HOME/.foundry/bin/foundryup && export PATH="$PATH:$XDG_CONFIG_HOME/.foundry/bin"
fi

# Install yq if needed
if ! command -v yq &>/dev/null; then
echo "Installing yq..."
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/local/bin/yq
chmod +x /usr/local/bin/yq
fi

# Create a new mnemonic
echo "Creating mnemonic..."
Expand Down
45 changes: 45 additions & 0 deletions spartan/terraform/gke-cluster/cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ resource "google_container_cluster" "primary" {
issue_client_certificate = false
}
}

resource_usage_export_config {
enable_network_egress_metering = true
enable_resource_consumption_metering = true

bigquery_destination {
dataset_id = "egress_consumption"
}
}
}

# Create 2 core node pool with local ssd
Expand Down Expand Up @@ -103,6 +112,42 @@ resource "google_container_node_pool" "aztec_nodes-2core" {
}
}

# Create 4 core node pool no ssd
resource "google_container_node_pool" "aztec_nodes-4core" {
name = "${var.cluster_name}-4core"
location = var.zone
cluster = var.cluster_name
version = var.node_version
# Enable autoscaling
autoscaling {
min_node_count = 0
max_node_count = 16
}

# Node configuration
node_config {
machine_type = "t2d-standard-4"

service_account = var.service_account
oauth_scopes = [
"https://www.googleapis.com/auth/cloud-platform"
]

labels = {
env = "production"
local-ssd = "false"
node-type = "network"
}
tags = ["aztec-gke-node", "aztec"]
}

# Management configuration
management {
auto_repair = true
auto_upgrade = false
}
}

# Create spot instance node pool with autoscaling
resource "google_container_node_pool" "spot_nodes_32core" {
name = "${var.cluster_name}-32core-spot"
Expand Down
5 changes: 2 additions & 3 deletions spartan/terraform/gke-cluster/main.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
terraform {
backend "s3" {
backend "gcs" {
bucket = "aztec-terraform"
key = "aztec-gke-cluster/terraform.tfstate"
region = "eu-west-2"
prefix = "terraform/state/gke-cluster"
}
required_providers {
google = {
Expand Down
Loading