Skip to content

Commit

Permalink
run geth properly, setting up prysm nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Anmol1696 committed Jan 7, 2025
1 parent e6fa2ee commit 28c119b
Show file tree
Hide file tree
Showing 10 changed files with 125 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- range $chain := .Values.chains }}
{{- if ne $chain.name "virtual" }}
{{- if not (hasPrefix "ethereum" $chain.name) }}
{{ $dataExposer := dict "chain" $chain.id "port" ($.Values.exposer.ports.rest | quote | default "8081") }}
{{ $defaultFile := $.Files.Get "defaults.yaml" | fromYaml }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- range $chain := .Values.chains }}
{{- if ne $chain.name "virtual" }}
{{- if not (hasPrefix "ethereum" $chain.name) }}
{{ $defaultFile := $.Files.Get "defaults.yaml" | fromYaml }}
{{ $chain := include "devnet.fullchain" (dict "name" $chain.id "file" $defaultFile "context" $) | fromJson }}
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- range $chain := .Values.chains }}
{{- if ne $chain.name "virtual" }}
{{- if not (hasPrefix "ethereum" $chain.name) }}
{{ $dataExposer := dict "chain" $chain.id "port" ($.Values.exposer.ports.rest | quote | default "8081") }}
{{ $defaultFile := $.Files.Get "defaults.yaml" | fromYaml }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ $portMap := dict "p2p" 26656 "address" 26658 "grpc" 9090 "grpc-web" 9091 "rest" 1317 }}
{{- range $chain := .Values.chains }}
{{- if ne $chain.name "virtual" }}
{{- if not (hasPrefix "ethereum" $chain.name) }}
{{ $defaultFile := $.Files.Get "defaults.yaml" | fromYaml }}

{{ $chain := include "devnet.fullchain" (dict "name" $chain.id "file" $defaultFile "context" $) | fromJson }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- range $chain := .Values.chains }}
{{- if ne $chain.name "virtual" }}
{{- if not (hasPrefix "ethereum" $chain.name) }}
{{- if gt $chain.numValidators 1.0 }}
{{ $dataExposer := dict "chain" $chain.id "port" ($.Values.exposer.ports.rest | quote | default "8081") }}
{{ $defaultFile := $.Files.Get "defaults.yaml" | fromYaml }}
Expand Down
92 changes: 92 additions & 0 deletions starship/charts/devnet/templates/chains/eth/beacon.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{{- range $chain := .Values.chains }}
{{- if hasPrefix "ethereum-beacon" $chain.name }}
{{ $defaultFile := $.Files.Get "defaults.yaml" | fromYaml }}

{{ $chain := include "devnet.fullchain" (dict "name" $chain.id "file" $defaultFile "context" $) | fromJson }}
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ $chain.name }}-beacon-chain
namespace: {{ $.Release.Namespace }}
labels:
app: {{ $chain.name }}-beacon-chain
spec:
serviceName: {{ $chain.name }}-beacon-chain
replicas: {{ $chain.replicas }}
selector:
matchLabels:
app.kubernetes.io/instance: {{ $chain.name }}
app.kubernetes.io/name: {{ $chain.id }}-genesis
template:
metadata:
annotations:
quality: release
role: api-gateway
sla: high
tier: gateway
labels:
app.kubernetes.io/instance: {{ $chain.name }}
app.kubernetes.io/type: {{ $chain.id }}
app.kubernetes.io/name: {{ $chain.id }}-beacon
app.kubernetes.io/rawname: {{ $chain.id }}
app.kubernetes.io/version: {{ $.Chart.AppVersion }}
spec:
{{- include "imagePullSecrets" $chain | indent 6 }}
initContainers:
- name: init-genesis
image: gcr.io/prysmaticlabs/prysm/cmd/prysmctl
imagePullPolicy: IfNotPresent
command:
- bash
- "-c"
- |
echo "Initializing genesis"
echo "Copy secrets over"
cp /config/jwt.hex /etc/secrets/jwt.hex
resources: {{- include "devnet.node.resources" ( dict "node" $chain "context" $ ) | trim | nindent 12 }}
volumeMounts:
- name: secrets
mountPath: /etc/secrets
- name: config
mountPath: /config
- name: ethereum
mountPath: /ethereum/consensus
containers:
- name: node
image: {{ $chain.image }}
imagePullPolicy: IfNotPresent
env:
- name: HTTP_PORT
value: "8545"
- name: WS_PORT
value: "8546"
- name: RPC_PORT
value: "8551"
command:
- bash
- "-c"
- |
echo "Starting consensus chain"
beacon-chain \
--execution-endpoint=http://localhost:8551 \
--jwt-secret=/etc/secrets/jwt.hex
resources: {{- include "devnet.node.resources" ( dict "node" $chain "context" $ ) | trim | nindent 12 }}
volumeMounts:
- name: ethereum
mountPath: /ethereum/execution
- name: secrets
mountPath: /etc/secrets
volumes:
- name: config
configMap:
name: config-{{ $chain.name }}
- name: ethereum
emptyDir: { }
- name: secrets
emptyDir: { }
---
{{- end }}
{{- end }}
9 changes: 6 additions & 3 deletions starship/charts/devnet/templates/chains/eth/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: genesis-{{ $chain.name }}
name: config-{{ $chain.name }}
data:
genesis.json: |-
{
Expand All @@ -17,16 +17,19 @@ data:
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0
"istanbulBlock": 0,
"terminalTotalDifficulty": 0
},
"difficulty": "0x1",
"gasLimit": "0x47b760",
"alloc": {
"0x0000000000000000000000000000000000000001": {
"balance": "0xde0b6b3a7640000"
"balance": "1000000000000000000000"
}
}
}
jwt.hex: |-
3fe89f53368415a79e065f3c885b7273b41540d5598488ef475cfdc4009850a4
---
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,22 @@ spec:
- "-c"
- |
echo "Initializing genesis"
cp /genesis/genesis.json /ethereum/execution/genesis.json
cp /config/genesis.json /ethereum/execution/genesis.json
cp /config/jwt.hex /etc/secrets/jwt.hex
geth --datadir /ethereum/execution init /ethereum/execution/genesis.json
resources: {{- include "devnet.node.resources" ( dict "node" $chain "context" $ ) | trim | nindent 12 }}
volumeMounts:
- name: genesis
mountPath: /genesis
- name: secrets
mountPath: /etc/secrets
- name: config
mountPath: /config
- name: ethereum
mountPath: /ethereum/execution
containers:
- name: node
image: {{ $chain.image }}
imagePullPolicy: IfNotPresent
env:
- name: NETWORK
value: {{ $chain.network }}
- name: LOG_LEVEL
value: {{ $chain.logLevel }}
- name: DATA_DIR
value: {{ $chain.dataDir }}
- name: HTTP_PORT
value: "8545"
- name: WS_PORT
Expand Down Expand Up @@ -90,17 +87,21 @@ spec:
--unlock=0x123463a4B065722E99115D6c222f267d9cABb524 \
--password=/dev/null \
--syncmode=full \
--networkid=32382
--networkid=1337
resources: {{- include "devnet.node.resources" ( dict "node" $chain "context" $ ) | trim | nindent 12 }}
volumeMounts:
- name: ethereum
mountPath: /ethereum/execution
- name: secrets
mountPath: /etc/secrets
volumes:
- name: genesis
- name: config
configMap:
name: genesis-{{ $chain.name }}
name: config-{{ $chain.name }}
- name: ethereum
emptyDir: { }
- name: secrets
emptyDir: { }
---
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion starship/charts/devnet/templates/chains/eth/service.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ $portMap := dict "http" 8545 "ws" 8546 "rpc" 8551 }}
{{- range $chain := .Values.chains }}
{{- if hasPrefix "ethereum-beacon" $chain.name }}
{{- if hasPrefix "ethereum-execution" $chain.name }}
{{ $defaultFile := $.Files.Get "defaults.yaml" | fromYaml }}

{{ $chain := include "devnet.fullchain" (dict "name" $chain.id "file" $defaultFile "context" $) | fromJson }}
Expand Down
8 changes: 8 additions & 0 deletions starship/tests/e2e/configs/eth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ chains:
name: ethereum-execution
image: ghcr.io/cosmology-tech/starship/ethereum/client-go:latest
numValidators: 1
beacon: ethereum-beacon
ports:
rest: 8545
rpc: 8551
- id: ethereum-beacon
name: ethereum-beacon
image: ghcr.io/cosmology-tech/starship/prysm/beacon-chain:stable
numValidators: 1
ports:
rest: 4000
rpc: 4001

0 comments on commit 28c119b

Please sign in to comment.