@@ -5,7 +5,7 @@ import { CharonService } from "./ethereum-services/CharonService";
55import { PrometheusService } from "./ethereum-services/PrometheusService" ;
66import { PrometheusNodeExporterService } from "./ethereum-services/PrometheusNodeExporterService" ;
77import { GrafanaService } from "./ethereum-services/GrafanaService" ;
8- import { PrysmBeaconService } from "./ethereum-services/PrysmBeaconService" ;
8+ import { PrysmBeaconService , checkpointSyncUrls } from "./ethereum-services/PrysmBeaconService" ;
99import { PrysmValidatorService } from "./ethereum-services/PrysmValidatorService" ;
1010import { FlashbotsMevBoostService } from "./ethereum-services/FlashbotsMevBoostService" ;
1111import { ServicePort , servicePortProtocol , changeablePorts } from "./ethereum-services/ServicePort" ;
@@ -16,7 +16,7 @@ import { MetricsExporterService } from "./ethereum-services/MetricsExporterServi
1616import { ExternalConsensusService } from "./ethereum-services/ExternalConsensusService" ;
1717import { ExternalExecutionService } from "./ethereum-services/ExternalExecutionService" ;
1818import { CustomService } from "./ethereum-services/CustomService" ;
19- import { LssEjectorService } from "./ethereum-services/LssEjectorService" ;
19+ import { LssEjectorService , stakingContractAddresses } from "./ethereum-services/LssEjectorService" ;
2020import { ConfigManager } from "./ConfigManager" ;
2121import YAML from "yaml" ;
2222// import { file } from "jszip";
@@ -1300,22 +1300,37 @@ export class ServiceManager {
13001300 isString = true ;
13011301 command = command . replaceAll ( / \n / gm, "" ) . replaceAll ( / \s \s + / gm, " " ) . split ( " " ) ;
13021302 }
1303+ if ( newNetwork === 'stratis' ) {
1304+ newNetwork = 'mainnet'
1305+ }
13031306 if ( service . service === "FlashbotsMevBoostService" ) {
13041307 command = service . entrypoint ;
1305- let index = command . findIndex ( ( c ) => / ^ - ( s t r a t i s | a u r o r i a $ ) / . test ( c ) ) ;
1308+ let index = command . findIndex ( ( c ) => / ^ - ( m a i n n e t | s t r a t i s | a u r o r i a $ ) / . test ( c ) ) ;
13061309 command [ index ] = "-" + newNetwork ;
13071310 index = command . findIndex ( ( c ) => c === "-relays" ) + 1 ;
13081311 command [ index ] = '""' ;
13091312 } else if ( service . service === "PrysmBeaconService" ) {
1310- let index = command . findIndex ( ( c ) => / - - ( s t r a t i s | a u r o r i a ) / . test ( c ) ) ;
1311- command [ index ] = "--" + newNetwork ;
1313+ let networkIndex = command . findIndex ( ( c ) => / - - ( m a i n n e t | s t r a t i s | a u r o r i a ) / . test ( c ) ) ;
1314+ if ( networkIndex !== - 1 ) {
1315+ command [ networkIndex ] = "--" + newNetwork ;
1316+ } else {
1317+ command . push ( `--${ newNetwork } ` )
1318+ }
1319+
1320+ const checkpointSyncIndex = command . findIndex ( c => / - - c h e c k p o i n t - s y n c - u r l / . test ( c ) )
1321+ if ( checkpointSyncIndex !== - 1 ) {
1322+ command [ checkpointSyncIndex ] = `--checkpoint-sync-url=${ checkpointSyncUrls [ newNetwork === 'mainnet' ? 'stratis' : newNetwork ] } `
1323+ }
1324+ } else if ( service . service === 'LssEjectorService' ) {
1325+ const index = command . findIndex ( c => / - - s t a k i n g _ a d d r e s s / . test ( c ) )
1326+ command [ index ] = `--staking_address=${ stakingContractAddresses [ newNetwork === 'mainnet' ? 'stratis' : newNetwork ] } `
13121327 } else {
1313- command = command . map ( ( c ) => {
1314- if ( / s t r a t i s | a u r o r i a / . test ( c ) ) {
1315- c = c . replace ( / s t r a t i s | a u r o r i a / , newNetwork ) ;
1316- }
1317- return c ;
1318- } ) ;
1328+ let networkIndex = command . findIndex ( ( c ) => / - - ( m a i n n e t | s t r a t i s | a u r o r i a ) / . test ( c ) ) ;
1329+ if ( networkIndex !== - 1 ) {
1330+ command [ networkIndex ] = "--" + newNetwork ;
1331+ } else {
1332+ command . push ( `-- ${ newNetwork } ` )
1333+ }
13191334 }
13201335 if ( isString ) return command . join ( " " ) . trim ( ) ;
13211336 return command ;
@@ -1332,6 +1347,15 @@ export class ServiceManager {
13321347 service . network = newNetwork ;
13331348 }
13341349 await this . createKeystores ( services ) ;
1350+ services . sort ( ( a , b ) => {
1351+ if ( a . service === 'GethService' || b . service === 'LssEjectorService' ) {
1352+ return - 1
1353+ } else if ( b . service === 'GethService' || a . service === 'LssEjectorService' ) {
1354+ return 1
1355+ }
1356+
1357+ return 0
1358+ } )
13351359 await Promise . all (
13361360 services . map ( async ( service ) => {
13371361 await this . nodeConnection . writeServiceConfiguration ( service . buildConfiguration ( ) ) ;
0 commit comments