11import { Chain , StarshipConfig } from '@starship-ci/types' ;
2+ import {
3+ Container ,
4+ ResourceRequirements ,
5+ StatefulSet ,
6+ Volume
7+ } from 'kubernetesjs' ;
28
39import * as helpers from '../../../helpers' ;
410import { IGenerator } from '../../../types' ;
5- import { Container , ResourceRequirements , StatefulSet , Volume } from 'kubernetesjs' ;
611
712/**
813 * Generates the StatefulSet for Ethereum chain
@@ -85,7 +90,8 @@ export class EthereumStatefulSetGenerator implements IGenerator {
8590 }
8691
8792 private createInitGenesisBeaconContainer ( chain : Chain ) : Container {
88- const prysmctlImage = chain . config ?. prysmctl ?. image ||
93+ const prysmctlImage =
94+ chain . config ?. prysmctl ?. image ||
8995 'ghcr.io/hyperweb-io/starship/prysm/cmd/prysmctl:v5.2.0' ;
9096 const numValidators = chain . config ?. validator ?. numValidator || 1 ;
9197
@@ -94,7 +100,8 @@ export class EthereumStatefulSetGenerator implements IGenerator {
94100 image : prysmctlImage ,
95101 imagePullPolicy : 'IfNotPresent' ,
96102 command : [ 'bash' , '-c' ] ,
97- args : [ `
103+ args : [
104+ `
98105mkdir -p /ethereum/consensus /ethereum/execution
99106cp /config/genesis.json /ethereum/execution/genesis.json
100107cp /config/config.yaml /ethereum/consensus/config.yaml
@@ -111,7 +118,8 @@ prysmctl testnet generate-genesis \\
111118
112119echo "Copy secrets over"
113120cp /config/jwt.hex /etc/secrets/jwt.hex
114- ` . trim ( ) ] ,
121+ ` . trim ( )
122+ ] ,
115123 resources : this . getNodeResources ( chain ) ,
116124 volumeMounts : [
117125 { name : 'secrets' , mountPath : '/etc/secrets' } ,
@@ -127,10 +135,12 @@ cp /config/jwt.hex /etc/secrets/jwt.hex
127135 image : chain . image ,
128136 imagePullPolicy : 'IfNotPresent' ,
129137 command : [ 'bash' , '-c' ] ,
130- args : [ `
138+ args : [
139+ `
131140echo "Initializing genesis geth"
132141geth --datadir /ethereum/execution init /ethereum/execution/genesis.json
133- ` . trim ( ) ] ,
142+ ` . trim ( )
143+ ] ,
134144 resources : this . getNodeResources ( chain ) ,
135145 volumeMounts : [
136146 { name : 'secrets' , mountPath : '/etc/secrets' } ,
@@ -166,7 +176,8 @@ geth --datadir /ethereum/execution init /ethereum/execution/genesis.json
166176 { name : 'RPC_PORT' , value : '8551' }
167177 ] ,
168178 command : [ 'bash' , '-c' ] ,
169- args : [ `
179+ args : [
180+ `
170181echo "Setting UDP buffer size"
171182sysctl -w net.core.rmem_max=16777216
172183sysctl -w net.core.wmem_max=16777216
@@ -196,7 +207,8 @@ geth --datadir /ethereum/execution --http \\
196207 --maxpeers=50 \\
197208 --nat=none \\
198209 --log.vmodule=engine=6
199- ` . trim ( ) ] ,
210+ ` . trim ( )
211+ ] ,
200212 resources : this . getNodeResources ( chain ) ,
201213 volumeMounts : [
202214 { name : 'ethereum' , mountPath : '/ethereum' } ,
@@ -217,7 +229,8 @@ geth --datadir /ethereum/execution --http \\
217229 }
218230
219231 private createBeaconChainContainer ( chain : Chain ) : Container {
220- const beaconImage = chain . config ?. beacon ?. image ||
232+ const beaconImage =
233+ chain . config ?. beacon ?. image ||
221234 'ghcr.io/hyperweb-io/starship/prysm/beacon-chain:v5.2.0' ;
222235
223236 return {
@@ -235,7 +248,8 @@ geth --datadir /ethereum/execution --http \\
235248 }
236249 ] ,
237250 command : [ 'bash' , '-c' ] ,
238- args : [ `
251+ args : [
252+ `
239253echo "Waiting 30 seconds for execution client to be ready..."
240254sleep 30
241255
@@ -256,7 +270,8 @@ beacon-chain \\
256270 --suggested-fee-recipient=0x123463a4B065722E99115D6c222f267d9cABb524 \\
257271 --minimum-peers-per-subnet=0 \\
258272 --force-clear-db
259- ` . trim ( ) ] ,
273+ ` . trim ( )
274+ ] ,
260275 resources : this . getNodeResources ( chain ) ,
261276 volumeMounts : [
262277 { name : 'ethereum' , mountPath : '/ethereum' } ,
@@ -274,7 +289,8 @@ beacon-chain \\
274289 }
275290
276291 private createValidatorContainer ( chain : Chain ) : Container {
277- const validatorImage = chain . config ?. validator ?. image ||
292+ const validatorImage =
293+ chain . config ?. validator ?. image ||
278294 'ghcr.io/hyperweb-io/starship/prysm/validator:v5.2.0' ;
279295 const numValidators = chain . config ?. validator ?. numValidator || 1 ;
280296
@@ -293,7 +309,8 @@ beacon-chain \\
293309 }
294310 ] ,
295311 command : [ 'bash' , '-c' ] ,
296- args : [ `
312+ args : [
313+ `
297314echo "Waiting 15 seconds for execution client to be ready..."
298315sleep 20
299316mkdir -p /ethereum/consensus/validator
@@ -310,7 +327,8 @@ validator \\
310327 --monitoring-host=0.0.0.0 \\
311328 --monitoring-port=8081 \\
312329 --suggested-fee-recipient=0x0C46c2cAFE097b4f7e1BB868B89e5697eE65f934
313- ` . trim ( ) ] ,
330+ ` . trim ( )
331+ ] ,
314332 resources : this . getNodeResources ( chain ) ,
315333 volumeMounts : [
316334 { name : 'ethereum' , mountPath : '/ethereum' } ,
@@ -348,7 +366,7 @@ validator \\
348366
349367 private getNodeResources ( chain : Chain ) : ResourceRequirements {
350368 // Use default resources or chain-specific resources
351- const defaultResources = this . config . resources ?. node
369+ const defaultResources = this . config . resources ?. node ;
352370
353371 return {
354372 requests : {
@@ -361,4 +379,4 @@ validator \\
361379 }
362380 } ;
363381 }
364- }
382+ }
0 commit comments