Skip to content

Commit

Permalink
More options added
Browse files Browse the repository at this point in the history
added more option, including slasher for Lighthouse as well as removing unused pruning option for Besu
  • Loading branch information
PatrickRL committed Sep 30, 2024
1 parent fe30748 commit f41e309
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 9 deletions.
10 changes: 10 additions & 0 deletions launcher/src/backend/ServiceManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,16 @@ export class ServiceManager {
await this.nodeConnection.sshService.exec(`rm -r ${dataDir}/*`);
}

async deleteSlasherVolume(serviceID) {
let services = await this.readServiceConfigurations();
let service = services.find((s) => s.id === serviceID);
let workingDir = this.getWorkindDir(service);
if (!workingDir.endsWith("/")) {
workingDir += "/";
}
await this.nodeConnection.sshService.exec(`rm -r ${workingDir}/slasher`);
}

getWorkindDir(service) {
if (service.volumes.length > 0) {
let volumeWithID = service.volumes.find((v) => v.destinationPath.includes(service.id));
Expand Down
11 changes: 11 additions & 0 deletions launcher/src/backend/ethereum-services/NethermindService.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ export class NethermindService extends NodeService {
"--HealthChecks.Enabled=true",
"--Pruning.Mode=Hybrid",
"--Pruning.FullPruningTrigger=StateDbSize",
"--Pruning.AvailableSpaceCheckEnabled=true",
"--Pruning.CacheMb=1024",
"--Pruning.PersistenceInterval=8192",
"--Pruning.PruningBoundary=64",
"--Pruning.TrackedPastKeyCountMemoryRatio=0.1",
"--Pruning.FullPruningCompletionBehavior=None",
"--Pruning.FullPruningDisableLowPriorityWrites=false",
"--Pruning.FullPruningMaxDegreeOfParallelism=0",
"--Pruning.FullPruningMemoryBudgetMb=4000",
"--Pruning.FullPruningMinimumDelayHours=240",
"--Pruning.FullPruningThresholdMb=256000",
], // command
["./nethermind"], // entrypoint
null, // env
Expand Down
4 changes: 4 additions & 0 deletions launcher/src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,10 @@ ipcMain.handle("getNewLauncherVersion", async () => {
return stereumUpdater.getNewLauncherVersion();
});

ipcMain.handle("deleteSlasherVolume", async (event, args) => {
return await serviceManager.deleteSlasherVolume(args);
});

// Scheme must be registered before the app is ready
protocol.registerSchemesAsPrivileged([{ scheme: "app", privileges: { secure: true, standard: true } }]);

Expand Down
69 changes: 69 additions & 0 deletions launcher/src/components/UI/node-page/sections/ExpertWindow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,49 @@ export default {
} else {
option.changeValue = true;
}
} else if (this.item.service === "ErigonService") {
let match = this.item.yaml.match(new RegExp(`--prune([=]?)([\\S*]+)?`));
switch (option.commands[0]) {
case "--prune-history": {
option.changeValue = match[2].includes("h") ? true : false;
break;
}
case "--prune-receipts": {
option.changeValue = match[2].includes("r") ? true : false;
break;
}
case "--prune-transaction": {
option.changeValue = match[2].includes("t") ? true : false;
break;
}
case "--prune-call-traces": {
option.changeValue = match[2].includes("c") ? true : false;
break;
}
}
this.somethingIsChanged(option);
}
else if (this.item.service === "NethermindService") {
if(!this.item.yaml.includes("Pruning.AvailableSpaceCheckEnabled=")){
const matchAllCommands = this.item.yaml.match(new RegExp(/--[\S]+/gm));
const lastCommand = matchAllCommands[matchAllCommands.length - 1];
const matchSpaces = this.item.yaml.match(new RegExp(`(\\s*- )${lastCommand}`));
let spaces = " ";
if (matchSpaces) {
spaces = matchSpaces[1];
}
this.item.yaml = this.item.yaml.replace(new RegExp(`${lastCommand}`), lastCommand + spaces + "--Pruning.AvailableSpaceCheckEnabled=true");
}
if(!this.item.yaml.includes("Pruning.FullPruningDisableLowPriorityWrites=")){
const matchAllCommands = this.item.yaml.match(new RegExp(/--[\S]+/gm));
const lastCommand = matchAllCommands[matchAllCommands.length - 1];
const matchSpaces = this.item.yaml.match(new RegExp(`(\\s*- )${lastCommand}`));
let spaces = " ";
if (matchSpaces) {
spaces = matchSpaces[1];
}
this.item.yaml = this.item.yaml.replace(new RegExp(`${lastCommand}`), lastCommand + spaces + "--Pruning.FullPruningDisableLowPriorityWrites=false");
}
} else {
option.changeValue = false;
}
Expand Down Expand Up @@ -587,6 +630,32 @@ export default {
this.item.yaml = this.item.yaml.replace(new RegExp(/\n^.*validators-proposer-config.*$/gm), "");
}
}
if (this.item.service === "LighthouseBeaconService") {
if (!this.item.yaml.includes("--slasher\n") && this.item.yaml.includes("/opt/app/slasher")) {
this.item.yaml = this.item.yaml.replace(/\n^.*--slasher-dir.*$/gm, "");
await ControlService.deleteSlasherVolume(this.item.config.serviceID);
this.item.yaml = this.item.yaml.replace(new RegExp(/\n^.*\/opt\/app\/slasher*$/gm), "");
} else if (this.item.yaml.includes("--slasher") && !this.item.yaml.includes("/opt/app/slasher")) {
this.item.yaml = this.item.yaml.replace("--slasher","--slasher\n - --slasher-dir=/opt/app/slasher");
this.item.yaml = this.item.yaml.replace("volumes:" ,"volumes:\n - /opt/stereum/lighthouse-" + this.item.config.serviceID +"/slasher:/opt/app/slasher")
}
}
if (this.item.service === "ErigonService") {
let erigonPruneSetting = "";
if (this.item.yaml.includes("--prune-history")) erigonPruneSetting += "h";
if (this.item.yaml.includes("--prune-receipts")) erigonPruneSetting += "r";
if (this.item.yaml.includes("--prune-transaction")) erigonPruneSetting += "t";
if (this.item.yaml.includes("--prune-call-traces")) erigonPruneSetting += "c";
if(erigonPruneSetting == "") erigonPruneSetting = "disabled";
this.item.yaml = this.item.yaml.replace(/\n^.*--prune-.*$/gm, "");
this.item.yaml = this.item.yaml.replace(/--prune=.*$/gm, "--prune=" + erigonPruneSetting);
}
if (this.item.service === "NethermindService") {let erigonPruneSetting = "";
if (!this.item.yaml.includes("--FullPruningDisableLowPriorityWrites=")) {
this.item.yaml = this.item.yaml.replace(/\n^.*--prune-.*$/gm, "");
this.item.yaml = this.item.yaml.replace(/--prune=.*$/gm, "--prune=" + erigonPruneSetting);
}
}
await ControlService.writeServiceYAML({
id: this.item.config.serviceID,
Expand Down
4 changes: 4 additions & 0 deletions launcher/src/store/ControlService.js
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,10 @@ class ControlService extends EventEmitter {
async getNewLauncherVersion() {
return this.promiseIpc.send("getNewLauncherVersion");
}

async deleteSlasherVolume(args){
return this.promiseIpc.send("deleteSlasherVolume", args)
}
}
if (!instance) {
instance = new ControlService(window.electron);
Expand Down
98 changes: 89 additions & 9 deletions launcher/src/store/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ export const useServices = defineStore("services", {
pattern: ["(- --http-address=)(.*)(\\n)"],
commands: ["--http-address"],
},
{
title: "Slasher",
type: "toggle",
changeValue: true,
icon: "/img/icon/service-setting-icons/doppelganger.png",
pattern: ["- --slasher"],
commands: ["--slasher"],
},
],
drag: true,
state: "exited",
Expand Down Expand Up @@ -535,6 +543,22 @@ export const useServices = defineStore("services", {
pattern: ["(- --keymanager-port=)(.*)(\\n)"],
commands: ["--keymanager-port"],
},
{
title: "Metrics Address",
type: "text",
changeValue: null,
icon: "/img/icon/service-setting-icons/ip-address.png",
pattern: ["(- --metrics-address=)(.*)(\\n)"],
commands: ["--metrics-address"],
},
{
title: "Metrics Port",
type: "text",
changeValue: null,
icon: "/img/icon/service-setting-icons/tcp_udp_port.png",
pattern: ["(- --metrics-port=)(.*)(\\n)"],
commands: ["--metrics-port"],
},
],
drag: true,
state: "exited",
Expand Down Expand Up @@ -967,14 +991,6 @@ export const useServices = defineStore("services", {
headerOption: false,
expertOptionsModal: false,
expertOptions: [
{
title: "Auto Pruning",
type: "toggle",
changeValue: true,
icon: "/img/icon/service-setting-icons/prunning.png",
pattern: ["(- --pruning-enabled=)(.*)(\\n)"],
commands: ["--pruning-enabled"],
},
{
title: "Gas Limit",
type: "text",
Expand Down Expand Up @@ -1151,11 +1167,43 @@ export const useServices = defineStore("services", {
{
title: "Disable Low Priority Writes",
type: "toggle",
changeValue: false,
changeValue: true,
icon: "/img/icon/service-setting-icons/prunning.png",
pattern: ["(--Pruning.FullPruningDisableLowPriorityWrites=)(.*)(\\n)"],
commands: ["--Pruning.FullPruningDisableLowPriorityWrites"],
},
{
title: "Max Degree Of Parallelism",
type: "text",
changeValue: null,
icon: "/img/icon/service-setting-icons/prunning.png",
pattern: ["(- --Pruning.FullPruningMaxDegreeOfParallelism=)(.*)(\\n)"],
commands: ["--Pruning.FullPruningMaxDegreeOfParallelism"],
},
{
title: "Memory Budget Mb",
type: "text",
changeValue: null,
icon: "/img/icon/service-setting-icons/prunning.png",
pattern: ["(- --Pruning.FullPruningMemoryBudgetMb=)(.*)(\\n)"],
commands: ["--Pruning.FullPruningMemoryBudgetMb"],
},
{
title: "Minimum Delay Hours",
type: "text",
changeValue: null,
icon: "/img/icon/service-setting-icons/prunning.png",
pattern: ["(- --Pruning.FullPruningMinimumDelayHours=)(.*)(\\n)"],
commands: ["--Pruning.FullPruningMinimumDelayHours"],
},
{
title: "Threshold Mb",
type: "text",
changeValue: null,
icon: "/img/icon/service-setting-icons/prunning.png",
pattern: ["(- --Pruning.FullPruningThresholdMb=)(.*)(\\n)"],
commands: ["--Pruning.FullPruningThresholdMb"],
},
{
title: "Gas Limit",
type: "text",
Expand Down Expand Up @@ -1500,6 +1548,38 @@ export const useServices = defineStore("services", {
pattern: ["(- --miner.gaslimit=)(.*)(\\n)"],
commands: ["--miner.gaslimit"],
},
{
title: "Prune history",
type: "toggle",
changeValue: true,
icon: "/img/icon/service-setting-icons/prunning.png",
pattern: ["- --prune-history"],
commands: ["--prune-history"],
},
{
title: "Prune receipts",
type: "toggle",
changeValue: true,
icon: "/img/icon/service-setting-icons/prunning.png",
pattern: ["- --prune-receipts"],
commands: ["--prune-receipts"],
},
{
title: "Prune transaction",
type: "toggle",
changeValue: true,
icon: "/img/icon/service-setting-icons/prunning.png",
pattern: ["- --prune-transaction"],
commands: ["--prune-transaction"],
},
{
title: "Prune call traces",
type: "toggle",
changeValue: true,
icon: "/img/icon/service-setting-icons/prunning.png",
pattern: ["- --prune-call-traces"],
commands: ["--prune-call-traces"],
},
{
title: "RPC Authentication Host Address",
type: "text",
Expand Down

0 comments on commit f41e309

Please sign in to comment.