-
Notifications
You must be signed in to change notification settings - Fork 327
/
Copy pathvalidator.yaml
296 lines (289 loc) · 11.3 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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
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
{{- if not .Values.storage.localSsd }}
volumeClaimTemplates:
- metadata:
name: validator-data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: {{ .Values.validator.storageSize }}
{{- end }}
template:
metadata:
labels:
{{- include "aztec-network.selectorLabels" . | nindent 8 }}
app: validator
spec:
{{- if .Values.network.gke }}
nodeSelector:
local-ssd: "{{ .Values.storage.localSsd }}"
node-type: network
{{- end }}
{{- if .Values.network.public }}
serviceAccountName: {{ include "aztec-network.fullname" . }}-node
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
{{- include "aztec-network.publicAntiAffinity" . | nindent 6 }}
{{- end }}
initContainers:
{{- include "aztec-network.p2pSetupContainer" . | nindent 8 }}
{{- include "aztec-network.serviceAddressSetupContainer" . | nindent 8 }}
# Get the private key from the mnemonic - based on the pod replica index
- name: get-private-key
image: {{ .Values.images.foundry.image }}
imagePullPolicy: {{ .Values.images.foundry.pullPolicy }}
command:
- "/bin/sh"
- "-c"
- |
source /scripts/get-private-key.sh
volumeMounts:
- name: scripts
mountPath: /scripts
- name: config
mountPath: /shared/config
env:
- name: KEY_INDEX_START
value: {{ .Values.aztec.validatorKeyIndexStart | quote }}
- name: MNEMONIC
value: {{ .Values.aztec.l1DeploymentMnemonic }}
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: wait-for-services
{{- include "aztec-network.image" . | nindent 10 }}
command:
- /bin/bash
- -c
- |
source /shared/config/service-addresses
cat /shared/config/service-addresses
{{- include "aztec-network.waitForEthereum" . | nindent 14 }}
if [ "{{ .Values.validator.dynamicBootNode }}" = "true" ]; then
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
{{- include "aztec-network.image" . | nindent 10 }}
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: config
mountPath: /shared/config
containers:
- name: validator
{{- include "aztec-network.image" . | nindent 10 }}
command:
- "/bin/bash"
- "-c"
- |
sleep 10 && \
source /shared/contracts/contracts.env && \
source /shared/p2p/p2p-addresses && \
source /shared/config/service-addresses && \
source /shared/config/keys.env && \
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
- name: validator-data
mountPath: {{ .Values.validator.dataDir }}
env:
- name: K8S_POD_UID
valueFrom:
fieldRef:
fieldPath: metadata.uid
- name: K8S_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: OTEL_SERVICE_NAME
value: validator
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: K8S_NAMESPACE_NAME
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: NODE_OPTIONS
value: "--max-old-space-size={{ .Values.validator.maxOldSpaceSize}}"
- name: AZTEC_PORT
value: "{{ .Values.validator.service.nodePort }}"
- name: LOG_LEVEL
value: "{{ .Values.validator.logLevel }}"
- name: LOG_JSON
value: "1"
- 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: ENFORCE_FEES
value: "{{ .Values.validator.sequencer.enforceFees }}"
- 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: 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 }}"
- name: VALIDATOR_ATTESTATIONS_POLLING_INTERVAL_MS
value: {{ .Values.validator.attestationPollingInterval | quote }}
- name: ARCHIVER_POLLING_INTERVAL_MS
value: {{ .Values.validator.archiverPollingInterval | quote }}
- name: ARCHIVER_VIEM_POLLING_INTERVAL_MS
value: {{ .Values.validator.viemPollingInterval | quote }}
- name: L1_READER_VIEM_POLLING_INTERVAL_MS
value: {{ .Values.validator.viemPollingInterval | quote }}
- name: SEQ_VIEM_POLLING_INTERVAL_MS
value: {{ .Values.validator.viemPollingInterval | quote }}
- name: L1_FIXED_PRIORITY_FEE_PER_GAS
value: {{ .Values.validator.l1FixedPriorityFeePerGas | quote }}
- name: L1_GAS_LIMIT_BUFFER_PERCENTAGE
value: {{ .Values.validator.l1GasLimitBufferPercentage | quote }}
- name: L1_GAS_PRICE_MAX
value: {{ .Values.validator.l1GasPriceMax | quote }}
- name: DATA_DIRECTORY
value: "{{ .Values.validator.dataDir }}"
- name: DATA_STORE_MAP_SIZE_KB
value: "{{ .Values.storage.dataStoreMapSize }}"
- name: WS_DB_MAP_SIZE_KB
value: "{{ .Values.storage.worldStateMapSize }}"
- name: USE_GCLOUD_OBSERVABILITY
value: "{{ .Values.telemetry.useGcloudObservability }}"
- name: OTEL_EXCLUDE_METRICS
value: "{{ .Values.telemetry.excludeMetrics }}"
{{- if .Values.blobSink.enabled }}
- name: BLOB_SINK_URL
value: {{ include "aztec-network.blobSinkUrl" . }}
{{- end }}
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: contracts-env
emptyDir: {}
- name: p2p-addresses
emptyDir: {}
- name: pxe-url
emptyDir: {}
- name: config
emptyDir: {}
{{- if .Values.storage.localSsd }}
- name: validator-data
emptyDir: {}
{{ else }}
- name: validator-data
persistentVolumeClaim:
claimName: validator-data
{{- end }}
---
# 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 }}
app: validator
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 }}