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
4 changes: 4 additions & 0 deletions spartan/aztec-network/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ http://{{ include "aztec-network.fullname" . }}-blob-sink.{{ .Release.Namespace
http://{{ include "aztec-network.fullname" . }}-metrics.{{ .Release.Namespace }}
{{- end -}}

{{- define "aztec-network.fullNodeAdminUrl" -}}
http://{{ include "aztec-network.fullname" . }}-full-node-admin.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.fullNode.service.adminPort }}
{{- end -}}

{{- define "helpers.flag" -}}
{{- $name := index . 0 -}}
{{- $value := index . 1 -}}
Expand Down
33 changes: 33 additions & 0 deletions spartan/aztec-network/templates/create-snapshot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{- if and (.Values.snapshots.uploadLocation) (.Values.snapshots.frequency) (gt (int .Values.fullNode.replicas) 0) }}
# Cronjob for creating and uploading database snapshots to a public location
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ include "aztec-network.fullname" . }}-upload-snapshots-cron-job
labels:
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
schedule: "{{ .Values.snapshots.frequency }}"
jobTemplate:
spec:
template:
metadata:
labels:
{{- include "aztec-network.selectorLabels" . | nindent 12 }}
app: request-upload-snapshot
spec:
restartPolicy: Never
{{- if .Values.network.public }}
serviceAccountName: {{ include "aztec-network.fullname" . }}-node
{{- end }}
containers:
- name: request-upload-snapshot
image: {{ .Values.images.curl.image }}
command:
- /bin/sh
- -c
- |
set -ex
echo "Starting snapshot upload to {{ .Values.snapshots.uploadLocation }} via {{ include "aztec-network.fullNodeAdminUrl" . }}"
curl -XPOST {{ include "aztec-network.fullNodeAdminUrl" . }} -d '{"method": "nodeAdmin_startSnapshotUpload", "params": ["{{ .Values.snapshots.uploadLocation }}"], "id": 1, "jsonrpc": "2.0"}' -H 'Content-Type: application/json'
{{- end }}
24 changes: 24 additions & 0 deletions spartan/aztec-network/templates/full-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ spec:
value: "--max-old-space-size={{ .Values.fullNode.maxOldSpaceSize}}"
- name: AZTEC_PORT
value: "{{ .Values.fullNode.service.nodePort }}"
- name: AZTEC_ADMIN_PORT
value: "{{ .Values.fullNode.service.adminPort }}"
- name: LOG_LEVEL
value: "{{ .Values.fullNode.logLevel }}"
- name: LOG_JSON
Expand Down Expand Up @@ -156,12 +158,15 @@ spec:
value: "{{ .Values.aztec.testAccounts }}"
- name: SPONSORED_FPC
value: "{{ .Values.aztec.sponsoredFPC }}"
- name: SYNC_SNAPSHOTS_URL
value: "{{ .Values.snapshots.syncUrl }}"
{{- if .Values.blobSink.enabled }}
- name: BLOB_SINK_URL
value: {{ include "aztec-network.blobSinkUrl" . }}
{{- end }}
ports:
- containerPort: {{ .Values.fullNode.service.nodePort }}
- containerPort: {{ .Values.fullNode.service.adminPort }}
- containerPort: {{ .Values.fullNode.service.p2pPort }}
- containerPort: {{ .Values.fullNode.service.p2pPort }}
protocol: UDP
Expand Down Expand Up @@ -223,6 +228,25 @@ spec:
- port: {{ .Values.fullNode.service.nodePort }}
name: node
---
# Internal service for accessing the admin port
apiVersion: v1
kind: Service
metadata:
name: {{ include "aztec-network.fullname" . }}-full-node-admin
labels:
{{- include "aztec-network.labels" . | nindent 4 }}
app: full-node
spec:
type: ClusterIP
selector:
{{- include "aztec-network.selectorLabels" . | nindent 4 }}
app: full-node
# The admin port is restricted from public access thanks to terraform/gke-cluster/firewall.tf
ports:
- port: {{ .Values.fullNode.service.adminPort }}
targetPort: {{ .Values.fullNode.service.adminPort }}
name: admin
---
{{- if hasKey .Values.fullNode "fixedExternalIP" }}
apiVersion: networking.gke.io/v1beta2
kind: ManagedCertificate
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 @@ -242,6 +242,8 @@ spec:
{{- end }}
- name: P2P_BOOTSTRAP_NODES_AS_FULL_PEERS
value: "{{ .Values.network.p2pBootstrapNodesAsFullPeers }}"
- name: SYNC_SNAPSHOTS_URL
value: "{{ .Values.snapshots.syncUrl }}"
ports:
- containerPort: {{ .Values.proverNode.service.nodePort }}
- containerPort: {{ .Values.proverNode.service.p2pPort }}
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 @@ -191,6 +191,8 @@ spec:
value: "{{ .Values.aztec.sponsoredFPC }}"
- name: P2P_BOOTSTRAP_NODES_AS_FULL_PEERS
value: "{{ .Values.network.p2pBootstrapNodesAsFullPeers }}"
- name: SYNC_SNAPSHOTS_URL
value: "{{ .Values.snapshots.syncUrl }}"
{{- if .Values.blobSink.enabled }}
- name: BLOB_SINK_URL
value: {{ include "aztec-network.blobSinkUrl" . }}
Expand Down
6 changes: 6 additions & 0 deletions spartan/aztec-network/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ telemetry:
useGcloudLogging: true
excludeMetrics: ""

snapshots:
uploadLocation:
syncUrl:
frequency:

images:
aztec:
image: aztecprotocol/aztec
Expand Down Expand Up @@ -116,6 +121,7 @@ fullNode:
service:
p2pPort: 40400
nodePort: 8080
adminPort: 8880
logLevel: "debug; info: aztec:simulator, json-rpc"
p2p:
enabled: "true"
Expand Down
5 changes: 5 additions & 0 deletions spartan/aztec-network/values/alpha-testnet.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
telemetry:
enabled: true

snapshots:
uploadLocation: "gs://aztec-testnet/snapshots/"
syncUrl: "https://storage.googleapis.com/aztec-testnet/snapshots/"
frequency: "0 0 * * *" # daily uploads at midnight

aztec:
realProofs: true
numberOfDefaultAccounts: 0
Expand Down
4 changes: 4 additions & 0 deletions yarn-project/aztec/src/cli/chain_l2_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export type L2ChainConfig = {
seqMinTxsPerBlock: number;
seqMaxTxsPerBlock: number;
realProofs: boolean;
snapshotsUrl: string;
};

export const testnetIgnitionL2ChainConfig: L2ChainConfig = {
Expand All @@ -38,6 +39,7 @@ export const testnetIgnitionL2ChainConfig: L2ChainConfig = {
seqMinTxsPerBlock: 0,
seqMaxTxsPerBlock: 0,
realProofs: true,
snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/',
};

export const alphaTestnetL2ChainConfig: L2ChainConfig = {
Expand All @@ -56,6 +58,7 @@ export const alphaTestnetL2ChainConfig: L2ChainConfig = {
seqMinTxsPerBlock: 0,
seqMaxTxsPerBlock: 4,
realProofs: true,
snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/',
};

export async function getBootnodes(networkName: NetworkNames) {
Expand Down Expand Up @@ -114,4 +117,5 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
enrichVar('DATA_DIRECTORY', path.join(process.env.HOME || '~', '.aztec', networkName, 'data'));
enrichVar('PROVER_REAL_PROOFS', config.realProofs.toString());
enrichVar('PXE_PROVER_ENABLED', config.realProofs.toString());
enrichVar('SYNC_SNAPSHOTS_URL', config.snapshotsUrl);
}