Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add initial setup for eth #595

Merged
merged 23 commits into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4ae6295
add initial setup for eth
Anmol1696 Dec 24, 2024
1ba8c4c
Merge branch 'main' into anmol/eth-setup
Anmol1696 Dec 24, 2024
e6fa2ee
initial setup for the execution layer chain
Anmol1696 Dec 26, 2024
28c119b
run geth properly, setting up prysm nodes
Anmol1696 Jan 7, 2025
32eb7cd
Merge branch 'main' into anmol/eth-setup
Anmol1696 Jan 7, 2025
9ef0eb4
add defaults
Anmol1696 Jan 7, 2025
4614bba
try and fix other beacon chain k8s yaml
Anmol1696 Jan 7, 2025
9033b00
update docker files for eth beacon
Anmol1696 Jan 15, 2025
79537da
add dockerfile for prysm dockerfiles and nodes
Anmol1696 Jan 15, 2025
1b00346
Merge branch 'main' into anmol/eth-setup
Anmol1696 Jan 15, 2025
f863846
got connection working with beacon and exeuction chain
Anmol1696 Jan 15, 2025
cf92b04
Merge branch 'main' into anmol/eth-setup
Anmol1696 Jan 15, 2025
4cba42d
fix chain-id for beacon-chain to connect to execution chain
Anmol1696 Jan 17, 2025
712d135
update beacon and eth configmaps
Anmol1696 Feb 3, 2025
8c1ff7b
add validator nodes as well
Anmol1696 Feb 4, 2025
790827c
Merge branch 'main' into anmol/eth-setup
Anmol1696 Feb 6, 2025
ff51838
Merge branch 'main' into anmol/eth-setup
Anmol1696 Feb 6, 2025
290cc0a
update eth reading from config
Anmol1696 Feb 8, 2025
7583c7a
update eth setup
Anmol1696 Feb 8, 2025
abbd38c
get chain assets from chain registry
Anmol1696 Feb 8, 2025
15e7032
unify execution and beacon chain into one
Anmol1696 Feb 8, 2025
c1bc917
update eth test config
Anmol1696 Feb 8, 2025
d5abb1c
Merge pull request #614 from hyperweb-io/anmol/unify-eth-setup
Anmol1696 Feb 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions starship/charts/devnet/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,47 @@ defaultChains:
exponent: 6
coingecko_id: stake
keywords: [ "stake" ]
ethereum:
image: ghcr.io/hyperweb-io/starship/ethereum/client-go:latest
home: /ethereum
binary: geth
prefix: eth
denom: wei
prettyName: Ethereum Execution Chain
coins: 100000000000000wei
hdPath: m/44'/60'/0'/0/0
coinType: 60
repo: https://github.com/ethereum/go-ethereum
assets:
- base: wei
name: "Ether"
description: "The native token of Ethereum"
display: "eth"
symbol: "ETH"
logo_URIs:
png: "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/eth-white.png"
svg: "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/eth-white.svg"
denom_units:
- denom: wei
exponent: 0
- denom: gwei
exponent: 9
- denom: ether
exponent: 18
aliases:
- "ether"
coingecko_id: "ethereum"
config:
beacon:
enabled: true
image: "ghcr.io/hyperweb-io/starship/prysm/beacon-chain:v5.2.0"
numValidator: 1
validator:
enabled: true
image: "ghcr.io/hyperweb-io/starship/prysm/validator:v5.2.0"
numValidator: 1
prysmctl:
image: "ghcr.io/hyperweb-io/starship/prysm/cmd/prysmctl:v5.2.0"
eth:
storageClassName: hostpath
genesisStateUrl: https://github.com/eth-clients/merge-testnets/blob/main/sepolia/genesis.ssz
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,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
188 changes: 188 additions & 0 deletions starship/charts/devnet/templates/chains/eth/beacon.yaml
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 }}
Loading
Loading