-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #595 from hyperweb-io/anmol/eth-setup
feature: add initial setup for eth
- Loading branch information
Showing
11 changed files
with
563 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
188 changes: 188 additions & 0 deletions
188
starship/charts/devnet/templates/chains/eth/beacon.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
{{- 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 }} | ||
{{ $initParams := dict "chains" (list $chain.id) "port" $.Values.exposer.ports.rest "context" $ }} | ||
|
||
{{ $executionChain := include "devnet.fullchain" (dict "name" $chain.config.execution.id "file" $defaultFile "context" $) | fromJson }} | ||
--- | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: {{ $chain.name }}-{{ $chain.id }} | ||
namespace: {{ $.Release.Namespace }} | ||
labels: | ||
app: {{ $chain.name }}-{{ $chain.id }} | ||
spec: | ||
serviceName: {{ $chain.name }}-{{ $chain.id }} | ||
replicas: {{ $chain.replicas }} | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/instance: {{ $chain.name }}-{{ $chain.id }} | ||
app.kubernetes.io/name: {{ $chain.name }}-{{ $chain.id }} | ||
template: | ||
metadata: | ||
annotations: | ||
quality: release | ||
role: api-gateway | ||
sla: high | ||
tier: gateway | ||
labels: | ||
app.kubernetes.io/instance: {{ $chain.name }}-{{ $chain.id }} | ||
app.kubernetes.io/type: {{ $chain.name }}-{{ $chain.id }} | ||
app.kubernetes.io/name: {{ $chain.name }}-{{ $chain.id }} | ||
app.kubernetes.io/rawname: "{{ $chain.id }}" | ||
app.kubernetes.io/version: {{ $.Chart.AppVersion }} | ||
spec: | ||
{{- include "imagePullSecrets" $chain | indent 6 }} | ||
initContainers: | ||
- name: init-genesis | ||
image: {{ $chain.config.prysmctl.image }} | ||
imagePullPolicy: Always | ||
command: | ||
- bash | ||
- "-c" | ||
- | | ||
mkdir -p /ethereum/consensus /ethereum/execution | ||
cp /config-execution/genesis.json /ethereum/execution/genesis.json | ||
cp /config-beacon/config.yaml /ethereum/consensus/config.yaml | ||
echo "Initializing genesis" | ||
prysmctl testnet generate-genesis \ | ||
--fork=capella \ | ||
--num-validators={{ $chain.config.validator.numValidator }} \ | ||
--genesis-time-delay=15 \ | ||
--output-ssz=/ethereum/consensus/genesis.ssz \ | ||
--chain-config-file=/ethereum/consensus/config.yaml \ | ||
--geth-genesis-json-in=/ethereum/execution/genesis.json \ | ||
--geth-genesis-json-out=/ethereum/execution/genesis.json | ||
echo "Copy secrets over" | ||
cp /config-execution/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-beacon | ||
mountPath: /config-beacon | ||
- name: config-execution | ||
mountPath: /config-execution | ||
- name: ethereum | ||
mountPath: /ethereum | ||
containers: | ||
- name: node | ||
image: {{ $chain.image }} | ||
imagePullPolicy: Always | ||
env: | ||
- name: HTTP_PORT | ||
value: "8545" | ||
- name: WS_PORT | ||
value: "8546" | ||
- name: RPC_PORT | ||
value: "8551" | ||
- name: NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
command: | ||
- bash | ||
- "-c" | ||
- | | ||
echo "Waiting 15 seconds for execution client to be ready..." | ||
sleep 15 | ||
echo "Starting consensus chain" | ||
beacon-chain \ | ||
--execution-endpoint=http://{{ $executionChain.name }}-{{ $executionChain.id }}-0.{{ $executionChain.name }}-{{ $executionChain.id }}.default.svc.cluster.local:8551 \ | ||
--jwt-secret=/etc/secrets/jwt.hex \ | ||
--accept-terms-of-use \ | ||
--http-host 0.0.0.0 \ | ||
--rpc-host 0.0.0.0 \ | ||
--chain-id {{ $executionChain.id }} \ | ||
--contract-deployment-block=0 \ | ||
--datadir /ethereum/consensus \ | ||
--genesis-state /ethereum/consensus/genesis.ssz \ | ||
--min-sync-peers=0 \ | ||
--chain-config-file=/ethereum/consensus/config.yaml \ | ||
--network-id {{ $executionChain.id }} \ | ||
--suggested-fee-recipient=0x123463a4B065722E99115D6c222f267d9cABb524 \ | ||
--minimum-peers-per-subnet=0 \ | ||
--force-clear-db | ||
resources: {{- include "devnet.node.resources" ( dict "node" $chain "context" $ ) | trim | nindent 12 }} | ||
volumeMounts: | ||
- name: ethereum | ||
mountPath: /ethereum | ||
- name: secrets | ||
mountPath: /etc/secrets | ||
- name: validator | ||
image: {{ $chain.config.validator.image }} | ||
imagePullPolicy: Always | ||
env: | ||
- name: NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
command: | ||
- bash | ||
- "-c" | ||
- | | ||
echo "Waiting 15 seconds for execution client to be ready..." | ||
sleep 20 | ||
mkdir -p /ethereum/consensus/validator | ||
echo "Starting validator node" | ||
validator \ | ||
--accept-terms-of-use \ | ||
--beacon-rpc-provider=localhost:4000 \ | ||
--datadir=/ethereum/consensus/validator \ | ||
--interop-num-validators={{ $chain.config.validator.numValidator }} \ | ||
--interop-start-index=0 \ | ||
--force-clear-db \ | ||
--chain-config-file=/ethereum/consensus/config.yaml \ | ||
--suggested-fee-recipient=0x0C46c2cAFE097b4f7e1BB868B89e5697eE65f934 | ||
resources: {{- include "devnet.node.resources" ( dict "node" $chain "context" $ ) | trim | nindent 12 }} | ||
volumeMounts: | ||
- name: ethereum | ||
mountPath: /ethereum | ||
- name: secrets | ||
mountPath: /etc/secrets | ||
- name: exposer | ||
image: {{ $.Values.exposer.image }} | ||
imagePullPolicy: Always | ||
env: | ||
- name: GENESIS_HOST | ||
value: "{{ $chain.name }}-{{ $chain.id }}-0" | ||
- name: GENESIS_PORT | ||
value: "{{ $.Values.exposer.ports.rest }}" | ||
- name: NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
- name: EXPOSER_HTTP_PORT | ||
value: "8081" | ||
- name: EXPOSER_GRPC_PORT | ||
value: "9099" | ||
- name: EXPOSER_GENESIS_FILE | ||
value: /ethereum/execution/genesis.json | ||
- name: EXPOSER_GENESIS_SSZ | ||
value: /ethereum/execution/genesis.ssz | ||
- name: EXPOSER_PRIV_VAL_FILE | ||
value: {{ $chain.home }}/config/priv_validator_key.json | ||
- name: EXPOSER_NODE_KEY_FILE | ||
value: {{ $chain.home }}/config/node_key.json | ||
- name: EXPOSER_NODE_ID_FILE | ||
value: {{ $chain.home }}/config/node_id.json | ||
- name: EXPOSER_PRIV_VAL_STATE_FILE | ||
value: {{ $chain.home }}/data/priv_validator_state.json | ||
resources: {{- include "devnet.exposer.resources" ( dict "node" $chain "context" $ ) | trim | nindent 12 }} | ||
volumes: | ||
- name: config | ||
configMap: | ||
name: config-ethereum | ||
- name: ethereum | ||
emptyDir: { } | ||
- name: secrets | ||
emptyDir: { } | ||
--- | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.