Skip to content

Commit

Permalink
Add redis stream support
Browse files Browse the repository at this point in the history
  • Loading branch information
a-thomas-22 committed Jul 9, 2024
1 parent 66bedb3 commit 7d1c05c
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 30 deletions.
2 changes: 1 addition & 1 deletion charts/nitro/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ maintainers:

type: application

version: 0.6.4
version: 0.7.0

appVersion: "v3.0.3-3ecd01e"
90 changes: 90 additions & 0 deletions charts/nitro/ci/sepolia-values-streams.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
startupProbe:
enabled: false

diagnosticMode: false

readinessProbe:
enabled: true
tcpSocket:
port: http-rpc
initialDelaySeconds: 10
periodSeconds: 3

jwtSecret:
enabled: false

blobPersistence:
enabled: true

validator:
enabled: true

splitvalidator:
mode: "streams"
deployments:
- name: "1"
- name: "2"

global:
configmap:
data:
metrics: true

metrics:
enabled: true

livenessProbe:
enabled: false

readinessProbe:
enabled: false

configmap:
data:
conf:
env-prefix: "NITROCI"
chain:
id: 421614
node:
staker:
enable: true
parent-chain-wallet:
account: "44a2864f7e5fc6ac1704ffae163730ad66d02fc1"
password: "test123"
parent-chain:
id: 11155111
blob-client:
blob-directory: /home/user/blobdata/
metrics: true

wallet:
files:
key1.json: '{"address":"44a2864f7e5fc6ac1704ffae163730ad66d02fc1","id":"0410ec05-04c1-47fa-bb1f-e14a8fa7c54b","version":3,"Crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"6cceaacd065a07ae7cc6cf9856f4e5fe"},"ciphertext":"33549ecaa70a3f31c9fbd16ecd93a9ddfcd5bbfde87420e3843312509d16002d","kdf":"scrypt","kdfparams":{"salt":"25a8b71f4fa6593753783746ed6a072b43713a8226b39855e35c8855690e3226","n":131072,"dklen":32,"p":1,"r":8},"mac":"56a7de08e50295f976bbfb71a4125379cf7d00ee0171c7fb43dd3aafdf770649"},"x-ethers":{"client":"ethers/6.12.1","gethFilename":"UTC--2024-05-07T05-35-58.0Z--44a2864f7e5fc6ac1704ffae163730ad66d02fc1","path":"m/44''/60''/0''/0/0","locale":"en","mnemonicCounter":"9810530864bddf04b8fee8b9e535fcdc","mnemonicCiphertext":"9f46a31391cca84a2dc361255e5ff467","version":"0.1"}}'

extraEnv:
- name: NITROCI_PARENT__CHAIN_CONNECTION_URL
valueFrom:
secretKeyRef:
name: ci-secret-nitro
key: PARENT_CHAIN_URL_SEPOLIA
- name: NITROCI_PARENT__CHAIN_BLOB__CLIENT_BEACON__URL
valueFrom:
secretKeyRef:
name: ci-secret-nitro
key: PARENT_CHAIN_BLOB_CLIENT_URL
- name: NITROCI_NODE
value: "https://sepolia-rollup.arbitrum.io/blob/$BASELINE_BLOB_CLIENT_KEY_SEPOLIA"

ci:
nitro-secret:
enabled: true
logLevel: INFO

rpc:
baselineUrl: https://sepolia-rollup.arbitrum.io/rpc/$BASELINE_RPC_KEY_SEPOLIA
url: $RPC_URL

testAccount:
privateKey: $TEST_ACCOUNT_PRIVATE_KEY
secretManifest:
enabled: true
51 changes: 27 additions & 24 deletions charts/nitro/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -107,33 +107,38 @@ Currently primarily used for stateless validator configuration
{{- /* Check if the validator is enabled */ -}}
{{- if .Values.validator.enabled -}}

{{- /* Initialize an empty list to hold deployment configurations */ -}}
{{- $deployments := list -}}
{{- /* Check if the mode is not streams */ -}}
{{- if ne .Values.validator.splitvalidator.mode "streams" -}}

{{- /* Get the full name for the deployment using the included nitro.fullname template */ -}}
{{- $fullName := include "nitro.fullname" . -}}

{{- /* Retrieve the port number from the validator's configuration */ -}}
{{- $port := int .Values.validator.splitvalidator.global.configmap.data.auth.port -}}
{{- /* Iterate over each deployment in the validator splitvalidator deployments */ -}}
{{- range .Values.validator.splitvalidator.deployments -}}
{{- /* Initialize an empty list to hold deployment configurations */ -}}
{{- $deployments := list -}}

{{- /* Construct the URL for the websocket connection */ -}}
{{- $url := printf "ws://%s-val-%s:%d" $fullName .name $port -}}
{{- /* Get the full name for the deployment using the included nitro.fullname template */ -}}
{{- $fullName := include "nitro.fullname" . -}}

{{- /* Create a deployment configuration dictionary with jwtsecret and URL */ -}}
{{- $deployment := dict "jwtsecret" "/secrets/jwtsecret" "url" $url -}}
{{- /* Retrieve the port number from the validator's configuration */ -}}
{{- $port := int .Values.validator.splitvalidator.global.configmap.data.auth.port -}}
{{- /* Append the deployment configuration to the deployments list */ -}}
{{- $deployments = append $deployments $deployment -}}
{{- end -}}
{{- /* Create the validation server config list in the configmap */ -}}
{{- $valconfig := dict "configmap" (dict "data" (dict "node" (dict "block-validator" (dict "validation-server-configs-list" (toJson $deployments | replace "\\" "")))) ) -}}
{{- /* Iterate over each deployment in the validator splitvalidator deployments */ -}}
{{- range .Values.validator.splitvalidator.deployments -}}
{{- /* Construct the URL for the websocket connection */ -}}
{{- $url := printf "ws://%s-val-%s:%d" $fullName .name $port -}}
{{- /* Create a deployment configuration dictionary with jwtsecret and URL */ -}}
{{- $deployment := dict "jwtsecret" "/secrets/jwtsecret" "url" $url -}}
{{- /* Append the deployment configuration to the deployments list */ -}}
{{- $deployments = append $deployments $deployment -}}
{{- end -}}
{{- /* Create the validation server config list in the configmap */ -}}
{{- $valconfig := dict "configmap" (dict "data" (dict "node" (dict "block-validator" (dict "validation-server-configs-list" (toJson $deployments | replace "\\" "")))) ) -}}
{{- /* Merge the new validation config into the original values */ -}}
{{- $values = merge $values $valconfig -}}
{{- /* Merge the new validation config into the original values */ -}}
{{- $values = merge $values $valconfig -}}
{{- end -}}
{{- end -}}
{{- end -}}
Expand All @@ -144,5 +149,3 @@ Currently primarily used for stateless validator configuration
{{- $processed -}}
{{- end -}}
7 changes: 5 additions & 2 deletions charts/nitro/templates/validator/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.validator.enabled }}
{{- if .Values.validator.enabled }}
{{- range .Values.validator.splitvalidator.deployments }}
---
apiVersion: v1
Expand All @@ -8,10 +8,13 @@ metadata:
labels:
{{- include "nitro.labels" $ | nindent 4 }}
data:
config.json: |
config.json: |-
{{- $global := dict }}
{{- if hasKey $.Values.validator.splitvalidator.global "configmap" }}
{{- $global = deepCopy $.Values.validator.splitvalidator.global.configmap.data }}
{{- if eq $.Values.validator.splitvalidator.mode "streams" }}
{{- $_ := unset $global "auth" }}
{{- end }}
{{- end }}
{{- $deployment := dict }}
{{- if hasKey . "configmap" }}
Expand Down
6 changes: 3 additions & 3 deletions charts/nitro/templates/validator/deployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ spec:
{{- end }}
{{- end }}
ports:
{{- if $mergedValues.auth.enabled }}
{{- if and $mergedValues.auth.enabled (ne $.Values.validator.splitvalidator.mode "streams") }}
- name: auth
containerPort: {{ $mergedValues.auth.port }}
{{- end }}
Expand All @@ -108,7 +108,7 @@ spec:
{{- end }}
{{- end }}
volumeMounts:
{{- if $.Values.jwtSecret.enabled }}
{{- if and $.Values.jwtSecret.enabled (ne $.Values.validator.splitvalidator.mode "streams") }}
- name: jwt-secret
mountPath: /secrets/jwtsecret
subPath: jwtSecret
Expand Down Expand Up @@ -149,7 +149,7 @@ spec:
{{- toYaml . | nindent 10 }}
{{- end }}
volumes:
{{- if $.Values.jwtSecret.enabled }}
{{- if and $.Values.jwtSecret.enabled (ne $.Values.validator.splitvalidator.mode "streams") }}
- name: jwt-secret
secret:
secretName: {{ include "nitro.fullname" $ }}-jwt
Expand Down
3 changes: 3 additions & 0 deletions charts/nitro/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ validator:
enabled: false

splitvalidator:
## @param validator.splitvalidator.mode Mode of the split validator (websocket or streams)
mode: "websocket"

## @param validator.splitvalidator.deployments List of deployments for the split validator. Each deploymeny can have its own image, config, etc.
deployments: []

Expand Down

0 comments on commit 7d1c05c

Please sign in to comment.