-
Notifications
You must be signed in to change notification settings - Fork 333
/
Copy pathvalidator.yaml
228 lines (225 loc) · 8.93 KB
/
validator.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "aztec-network.fullname" . }}-validator
labels:
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
serviceName: {{ include "aztec-network.fullname" . }}-validator
replicas: {{ .Values.validator.replicas }}
podManagementPolicy: Parallel
selector:
matchLabels:
{{- include "aztec-network.selectorLabels" . | nindent 6 }}
app: validator
template:
metadata:
labels:
{{- include "aztec-network.selectorLabels" . | nindent 8 }}
app: validator
spec:
{{- if .Values.network.public }}
hostNetwork: true
{{- include "aztec-network.publicAntiAffinity" . | nindent 6 }}
{{- end }}
serviceAccountName: {{ include "aztec-network.fullname" . }}-node
initContainers:
{{- include "aztec-network.p2pSetupContainer" . | nindent 8 }}
{{- include "aztec-network.serviceAddressSetupContainer" . | nindent 8 }}
- name: wait-for-services
image: {{ .Values.images.aztec.image }}
command:
- /bin/bash
- -c
- |
source /shared/config/service-addresses
# First check ethereum node
until curl -s -X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' \
$ETHEREUM_HOST | grep -q reth; do
echo "Waiting for Ethereum node..."
sleep 5
done
echo "Ethereum node is ready!"
{{- if .Values.telemetry.enabled }}
until curl --head --silent {{ include "aztec-network.otelCollectorMetricsEndpoint" . }} > /dev/null; do
echo "Waiting for OpenTelemetry collector..."
sleep 5
done
echo "OpenTelemetry collector is ready!"
{{- end }}
if [ "{{ .Values.validator.dynamicBootNode }}" = "true" ]; then
# Get the list of pod IPs for the validator service
echo "{{ include "aztec-network.pxeUrl" . }}" > /shared/pxe/pxe_url
else
until curl --silent --head --fail "${BOOT_NODE_HOST}/status" > /dev/null; do
echo "Waiting for boot node..."
sleep 5
done
echo "Boot node is ready!"
echo "${BOOT_NODE_HOST}" > /shared/pxe/pxe_url
fi
volumeMounts:
- name: pxe-url
mountPath: /shared/pxe
- name: scripts
mountPath: /scripts
- name: config
mountPath: /shared/config
- name: configure-validator-env
image: "{{ .Values.images.aztec.image }}"
imagePullPolicy: {{ .Values.images.aztec.pullPolicy }}
command:
- "/bin/bash"
- "-c"
- |
source /shared/config/service-addresses && \
cp /scripts/configure-validator-env.sh /tmp/configure-validator-env.sh && \
chmod +x /tmp/configure-validator-env.sh && \
/tmp/configure-validator-env.sh "$(cat /shared/pxe/pxe_url)"
volumeMounts:
- name: contracts-env
mountPath: /shared/contracts
- name: pxe-url
mountPath: /shared/pxe
- name: scripts
mountPath: /scripts
- name: validator-keys
mountPath: /app/config
readOnly: true
- name: config
mountPath: /shared/config
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
containers:
- name: validator
image: "{{ .Values.images.aztec.image }}"
imagePullPolicy: {{ .Values.images.aztec.pullPolicy }}
command:
- "/bin/bash"
- "-c"
- |
sleep 10 && \
source /shared/contracts/contracts.env && \
source /shared/p2p/p2p-addresses && \
source /shared/config/service-addresses && \
env && \
node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js start --node --archiver --sequencer
startupProbe:
httpGet:
path: /status
port: {{ .Values.validator.service.nodePort }}
failureThreshold: {{ .Values.validator.startupProbe.failureThreshold }}
periodSeconds: {{ .Values.validator.startupProbe.periodSeconds }}
livenessProbe:
exec:
command:
- /bin/sh
- -c
- curl -fSs http://127.0.0.1:{{ .Values.validator.service.nodePort }}/status
initialDelaySeconds: 30
periodSeconds: 5
timeoutSeconds: 30
failureThreshold: 3
volumeMounts:
- name: contracts-env
mountPath: /shared/contracts
- name: p2p-addresses
mountPath: /shared/p2p
- name: config
mountPath: /shared/config
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: AZTEC_PORT
value: "{{ .Values.validator.service.nodePort }}"
- name: LOG_LEVEL
value: "{{ .Values.validator.logLevel }}"
- name: LOG_JSON
value: "1"
- name: DEBUG
value: "{{ .Values.validator.debug }}"
- name: P2P_ENABLED
value: "{{ .Values.validator.p2p.enabled }}"
- name: VALIDATOR_DISABLED
value: "{{ .Values.validator.validator.disabled }}"
- name: VALIDATOR_REEXECUTE
value: "{{ .Values.validator.validator.reexecute }}"
- name: SEQ_MAX_SECONDS_BETWEEN_BLOCKS
value: "{{ .Values.validator.sequencer.maxSecondsBetweenBlocks }}"
- name: SEQ_MIN_TX_PER_BLOCK
value: "{{ .Values.validator.sequencer.minTxsPerBlock }}"
- name: SEQ_MAX_TX_PER_BLOCK
value: "{{ .Values.validator.sequencer.maxTxsPerBlock }}"
- name: SEQ_ENFORCE_TIME_TABLE
value: "{{ .Values.validator.sequencer.enforceTimeTable }}"
- name: L1_CHAIN_ID
value: "{{ .Values.ethereum.chainId }}"
- name: OTEL_RESOURCE_ATTRIBUTES
value: service.name={{ .Release.Name }},service.namespace={{ .Release.Namespace }},service.version={{ .Chart.AppVersion }},environment={{ .Values.environment | default "production" }}
- name: OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
value: {{ include "aztec-network.otelCollectorMetricsEndpoint" . | quote }}
- name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
value: {{ include "aztec-network.otelCollectorTracesEndpoint" . | quote }}
- name: OTEL_EXPORTER_OTLP_LOGS_ENDPOINT
value: {{ include "aztec-network.otelCollectorLogsEndpoint" . | quote }}
- name: ETHEREUM_SLOT_DURATION
value: "{{ .Values.ethereum.blockTime }}"
- name: AZTEC_SLOT_DURATION
value: "{{ .Values.aztec.slotDuration }}"
- name: AZTEC_EPOCH_DURATION
value: "{{ .Values.aztec.epochDuration }}"
- name: AZTEC_EPOCH_PROOF_CLAIM_WINDOW_IN_L2_SLOTS
value: "{{ .Values.aztec.epochProofClaimWindow }}"
ports:
- containerPort: {{ .Values.validator.service.nodePort }}
- containerPort: {{ .Values.validator.service.p2pTcpPort }}
- containerPort: {{ .Values.validator.service.p2pUdpPort }}
protocol: UDP
resources:
{{- toYaml .Values.validator.resources | nindent 12 }}
volumes:
- name: scripts
configMap:
name: {{ include "aztec-network.fullname" . }}-scripts
- name: validator-keys
configMap:
name: {{ include "aztec-network.fullname" . }}-validator-keys
- name: contracts-env
emptyDir: {}
- name: p2p-addresses
emptyDir: {}
- name: pxe-url
emptyDir: {}
- name: config
emptyDir: {}
---
# If this is not a public network, create a headless service for StatefulSet DNS entries
{{ if not .Values.network.public }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "aztec-network.fullname" . }}-validator
labels:
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
clusterIP: None
selector:
{{- include "aztec-network.selectorLabels" . | nindent 4 }}
app: validator
ports:
- port: {{ .Values.validator.service.p2pTcpPort }}
name: p2p-tcp
protocol: TCP
- port: {{ .Values.validator.service.p2pUdpPort }}
name: p2p-udp
protocol: UDP
- port: {{ .Values.validator.service.nodePort }}
name: node
protocol: TCP
{{ end }}