Skip to content

Commit 7e753b6

Browse files
authored
ADD: Ethrex implementation (#2291)
* ADD: Ethrex implementation * fix: `buildExecutionClientMetricsEndpoint`
1 parent 9ea9253 commit 7e753b6

File tree

9 files changed

+167
-0
lines changed

9 files changed

+167
-0
lines changed

controls/roles/manage-service/templates/prometheus.yml.j2

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,4 +464,20 @@ scrape_configs:
464464
{% endif %}
465465
]
466466

467+
# ethrex
468+
- job_name: ethrex
469+
metrics_path: /metrics
470+
static_configs:
471+
- targets: [
472+
{% set targets = [] %}
473+
{%- for service_config in service_configs.results %}
474+
{%- if (service_config.content | b64decode | from_yaml).service == "EthrexService" %}
475+
{%- set _ = targets.append("stereum-" ~ (service_config.content | b64decode | from_yaml).id ~ ":9090") %}
476+
{%- endif %}
477+
{% endfor %}
478+
{% if targets %}
479+
"{{ targets | join('",\n "') }}"
480+
{% endif %}
481+
]
482+
467483
# EOF
65.9 KB
Loading
257 KB
Loading

launcher/src/backend/Monitoring.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ export class Monitoring {
962962
BesuService: 8545,
963963
NethermindService: 8545,
964964
ErigonService: 8545,
965+
EthrexService: 8545,
965966
};
966967

967968
// Extract additional params
@@ -1109,6 +1110,7 @@ export class Monitoring {
11091110
NethermindService: ["nethermind_blocks", "nethermind_blocks"], // OK [there is only one label] - query for job="nethermind"
11101111
// Note: Erigon labels are taken from their official Grafana Dashboard, however those are not available thru Prometheus!
11111112
ErigonService: ["chain_head_header", "chain_head_block"], // TODO - query for job="erigon"
1113+
EthrexService: ["block_number", "head_height"], // NOT OK - query for job="ethrex"
11121114
},
11131115
};
11141116

@@ -1125,6 +1127,7 @@ export class Monitoring {
11251127
BesuService: "besu",
11261128
NethermindService: "nethermind",
11271129
ErigonService: "erigon",
1130+
EthrexService: "ethrex",
11281131
};
11291132

11301133
// Execution clients that should be queried by RPC for chain head block
@@ -1134,6 +1137,7 @@ export class Monitoring {
11341137
// 'BesuService',
11351138
"NethermindService",
11361139
"ErigonService",
1140+
"EthrexService",
11371141
];
11381142

11391143
// Merge all labels for Prometheus query
@@ -1317,6 +1321,7 @@ export class Monitoring {
13171321
BesuService: ["ethereum_peer_count"],
13181322
NethermindService: ["nethermind_sync_peers"],
13191323
ErigonService: ["p2p_peers"],
1324+
EthrexService: ["ethrex_p2p_peer_count"],
13201325
},
13211326
};
13221327

@@ -1333,6 +1338,7 @@ export class Monitoring {
13331338
BesuService: "besu",
13341339
NethermindService: "nethermind",
13351340
ErigonService: "erigon",
1341+
EthrexService: "ethrex",
13361342
};
13371343

13381344
// Merge all labels for Prometheus query
@@ -1478,6 +1484,11 @@ export class Monitoring {
14781484
// https://github.com/ledgerwatch/erigon/issues/2853
14791485
optnam = "--maxpeers";
14801486
defval = 100;
1487+
} else if (clt.service == "EthrexService") {
1488+
// --p2p.target-peers (Default: 100)
1489+
// https://docs.ethrex.xyz/CLI.html
1490+
optnam = "--p2p.target-peers";
1491+
defval = 100;
14811492
} else {
14821493
return;
14831494
}

launcher/src/backend/OneClickInstall.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ export class OneClickInstall {
114114
this.executionClient.push(this.serviceManager.getService("ErigonService", args));
115115
}
116116

117+
if (constellation.includes("EthrexService")) {
118+
//EthrexService
119+
this.executionClient.push(this.serviceManager.getService("EthrexService", args));
120+
}
121+
117122
if (constellation.includes("FlashbotsMevBoostService")) {
118123
//FlashbotsMevBoostService
119124
this.mevboost = this.serviceManager.getService("FlashbotsMevBoostService", args);
@@ -517,6 +522,9 @@ export class OneClickInstall {
517522
client.command[client.command.findIndex((c) => c.includes("--Pruning.Mode="))] = "--Pruning.Mode=None";
518523
client.command = client.command.filter((c) => !c.includes("--Pruning.FullPruningTrigger"));
519524
break;
525+
case "EthrexService":
526+
// TODO: add archive flags for ethrex (when they are available)
527+
break;
520528
}
521529
});
522530
this.beaconService

launcher/src/backend/ServiceManager.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import { OpRethService } from "./ethereum-services/OpRethService";
4141
import { OpNodeBeaconService } from "./ethereum-services/OpNodeBeaconService";
4242
import { L2GethService } from "./ethereum-services/L2GethService";
4343
import { SSVNOMService } from "./ethereum-services/SSVNOMService";
44+
import { EthrexService } from "./ethereum-services/EthrexService";
4445

4546
import YAML from "yaml";
4647
// import { file } from "jszip";
@@ -197,6 +198,8 @@ export class ServiceManager {
197198
services.push(GrandineBeaconService.buildByConfiguration(config));
198199
} else if (config.service == "SSVNOMService") {
199200
services.push(SSVNOMService.buildByConfiguration(config));
201+
} else if (config.service == "EthrexService") {
202+
services.push(EthrexService.buildByConfiguration(config));
200203
}
201204
} else {
202205
log.error("found configuration without service!");
@@ -1022,6 +1025,16 @@ export class ServiceManager {
10221025
service = ErigonService.buildByUserInput(args.network, ports, args.installDir + "/erigon");
10231026
return service;
10241027

1028+
case "EthrexService":
1029+
ports = [
1030+
new ServicePort(null, 30303, 30303, servicePortProtocol.tcp),
1031+
new ServicePort(null, 30303, 30303, servicePortProtocol.udp),
1032+
new ServicePort("127.0.0.1", args.port ? args.port : 8545, 8545, servicePortProtocol.tcp),
1033+
new ServicePort("127.0.0.1", 8546, 8546, servicePortProtocol.tcp),
1034+
];
1035+
service = EthrexService.buildByUserInput(args.network, ports, args.installDir + "/ethrex");
1036+
return service;
1037+
10251038
case "LighthouseBeaconService":
10261039
ports = [
10271040
new ServicePort(null, 9000, 9000, servicePortProtocol.tcp),
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import { NodeService } from "./NodeService";
2+
import { ServiceVolume } from "./ServiceVolume";
3+
4+
export class EthrexService extends NodeService {
5+
static buildByUserInput(network, ports, dir) {
6+
const service = new EthrexService();
7+
service.setId();
8+
const workingDir = service.buildWorkingDir(dir);
9+
const dataDir = "/opt/app/data";
10+
const JWTDir = "/engine.jwt";
11+
const volumes = [new ServiceVolume(workingDir + "/data", "/opt/app/data"), new ServiceVolume(workingDir + "/engine.jwt", JWTDir)];
12+
network = network === "op-mainnet" ? "mainnet" : network === "op-sepolia" ? "sepolia" : network;
13+
14+
service.init(
15+
"EthrexService", // service
16+
service.id, // id
17+
1, // configVersion
18+
"ghcr.io/lambdaclass/ethrex", // image
19+
"9.0.0", // imageVersion
20+
[
21+
`--network=${network}`,
22+
`--datadir=${dataDir}`,
23+
"--syncmode=snap",
24+
"--p2p.addr=0.0.0.0",
25+
"--p2p.port=30303", //tcp
26+
"--discovery.port=30303", //udp
27+
"--http.addr=0.0.0.0",
28+
"--http.port=8545",
29+
"--ws.enabled",
30+
"--ws.addr=0.0.0.0",
31+
"--ws.port=8546",
32+
"--authrpc.addr=0.0.0.0",
33+
"--authrpc.port=8551",
34+
`--authrpc.jwtsecret=${JWTDir}`,
35+
"--log.level=info",
36+
"--log.color=never",
37+
"--metrics",
38+
"--metrics.addr=0.0.0.0",
39+
"--metrics.port=9090",
40+
], // command
41+
["ethrex"], // entrypoint
42+
null, // env
43+
ports, // ports
44+
volumes, // volumes
45+
null, // user
46+
network // network
47+
// executionClients
48+
// consensusClients
49+
);
50+
return service;
51+
}
52+
53+
static buildByConfiguration(config) {
54+
const service = new EthrexService();
55+
56+
service.initByConfig(config);
57+
58+
return service;
59+
}
60+
61+
buildExecutionClientHttpEndpointUrl() {
62+
return "http://stereum-" + this.id + ":8545";
63+
}
64+
65+
buildExecutionClientWsEndpointUrl() {
66+
return "ws://stereum-" + this.id + ":8546";
67+
}
68+
69+
buildExecutionClientEngineRPCHttpEndpointUrl() {
70+
return "http://stereum-" + this.id + ":8551";
71+
}
72+
73+
buildExecutionClientEngineRPCWsEndpointUrl() {
74+
return "ws://stereum-" + this.id + ":8551";
75+
}
76+
77+
buildExecutionClientMetricsEndpoint() {
78+
return "stereum-" + this.id + ":9090";
79+
}
80+
81+
getDataDir() {
82+
return this.volumes.find((volume) => volume.servicePath === "/opt/app/data")?.destinationPath;
83+
}
84+
}
85+
86+
// EOF

launcher/src/backend/ethereum-services/ServicePort.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const changeablePorts = {
99
GethService: 8545,
1010
RethService: 8545,
1111
NethermindService: 8545,
12+
EthrexService: 8545,
1213
LighthouseBeaconService: 5052,
1314
LighthouseValidatorService: 5062,
1415
LodestarBeaconService: 9596,

launcher/src/store/services.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2644,6 +2644,38 @@ export const useServices = defineStore("services", {
26442644
network: "",
26452645
},
26462646
},
2647+
{
2648+
id: 13,
2649+
name: "Ethrex",
2650+
service: "EthrexService",
2651+
category: "execution",
2652+
displayCategory: "exc",
2653+
displayTooltip: false,
2654+
displayPluginMenu: false,
2655+
serviceIsPending: false,
2656+
modifierPanel: false,
2657+
replacePanel: false,
2658+
addPanel: false,
2659+
path: "/ethrex",
2660+
linkUrl: "",
2661+
docsUrl: "https://docs.ethrex.xyz/",
2662+
icon: "/img/icon/service-icons/execution/Ethrex.png",
2663+
sIcon: "/img/icon/service-icons/execution/Ethrex-s.png",
2664+
headerOption: false,
2665+
expertOptionsModal: false,
2666+
expertOptions: [],
2667+
drag: true,
2668+
state: "exited",
2669+
config: {
2670+
serviceID: "",
2671+
configVersion: "",
2672+
image: "",
2673+
imageVersion: "",
2674+
ports: [],
2675+
volumes: [],
2676+
network: "",
2677+
},
2678+
},
26472679
],
26482680
versions: {},
26492681
stereumVersion: {},

0 commit comments

Comments
 (0)