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

ADD: Additional Client Options #2049

Merged
merged 8 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 28 additions & 0 deletions launcher/public/output.css
Original file line number Diff line number Diff line change
Expand Up @@ -1840,6 +1840,10 @@ video {
height: 70px;
}

.h-\[74\%\]{
height: 74%;
}

.h-\[8\%\]{
height: 8%;
}
Expand Down Expand Up @@ -2026,6 +2030,30 @@ video {
max-height: 100%;
}

.max-h-\[74vh\]{
max-height: 74vh;
}

.max-h-\[72vh\]{
max-height: 72vh;
}

.max-h-\[65vh\]{
max-height: 65vh;
}

.max-h-\[50vh\]{
max-height: 50vh;
}

.max-h-\[60vh\]{
max-height: 60vh;
}

.max-h-\[59vh\]{
max-height: 59vh;
}

.min-h-11{
min-height: 2.75rem;
}
Expand Down
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
108 changes: 96 additions & 12 deletions launcher/src/components/UI/node-page/sections/ExpertWindow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,29 @@
@click="$emit('hideModal')"
></div>
<div
class="w-full h-[492px] absolute top-[56px] left-[1px] z-30 overflow-y-auto bg-[#2d3438] rounded-md flex flex-col justify-start items-center p-4"
class="w-full h-[492px] absolute top-[56px] left-[1px] z-30 bg-[#2d3438] rounded-md flex flex-col justify-start items-center p-4"
:class="leftDistance ? leftDistance : 'left-0'"
aria-labelledby="modal-title"
role="dialog"
aria-modal="true"
>
<div class="flex flex-col justify-start items-start w-full border-b pb-1 border-gray-600">
<span class="text-xl text-gray-200 font-bold uppercase">{{ item.name }}</span>
<p class="text-sm text-gray-200 capitalize">
{{ item.category }}
<span v-if="item.category != 'service'">client</span>
</p>
<span class="text-sm text-gray-200">ID: {{ item.config.serviceID }}</span>
<div class="expert-header w-full h-1/6">
<div class="flex flex-col justify-start items-start w-full border-b pb-1 border-gray-600">
<span class="text-xl text-gray-200 font-bold uppercase">{{ item.name }}</span>
<p class="text-sm text-gray-200 capitalize">
{{ item.category }}
<span v-if="item.category != 'service'">client</span>
</p>
<span class="text-sm text-gray-200">ID: {{ item.config.serviceID }}</span>
</div>
</div>
<div class="w-full h-[30px] space-y-2 mt-2" :class="{ shorterRowBox: isExpertModeActive }">

<div
class="row-part-scrollable w-full overflow-y-auto space-y-2 mt-2"
:class="
isExpertModeActive || ssvExpertModeActive || ssvDkgExpertModeActive || prometheusExpertModeActive ? 'h-[40px]' : 'max-h-[59vh]'
"
>
<!-- expert mode row -->
<div
v-if="!ssvExpertModeActive && !ssvDkgExpertModeActive && !prometheusExpertModeActive"
Expand Down Expand Up @@ -240,7 +248,7 @@
></textarea>
</div>
</div>
<div class="w-full flex justify-between items-center absolute bottom-1 px-4 pb-2">
<div class="footer-expert h-10 w-full flex justify-between items-center absolute bottom-1 px-4 pb-2">
<!-- service version -->
<p class="w-1/2 text-sm text-gray-200">
version: <span>{{ item.config.imageVersion }}</span>
Expand All @@ -257,7 +265,7 @@

<button
v-if="!nothingsChanged"
class="expert-modal-btn w-[100px] h-8 px-4 py-1 font-medium tracking-wide text-white transition-colors duration-300 transform bg-[#609879] rounded-sm hover:bg-[#4c7960] focus:outline-none uppercase text-sm"
class="expert-modal-btn w-[100px] h-8 px-4 py-1 font-medium tracking-wide text-white divnsition-colors duration-300 transform bg-[#609879] rounded-sm hover:bg-[#4c7960] focus:outline-none uppercase text-sm"
@click="confirmExpertChanges(item, false)"
>
Confirm
Expand Down Expand Up @@ -402,6 +410,54 @@ 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 @@ -577,6 +633,34 @@ 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")) {
let path = this.item.yaml.match(/^.*beacon:\/opt\/app\/beacon.*$/gm)[0].replace(new RegExp(/beacon/gm), "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" + path);
}
}
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 Expand Up @@ -1136,7 +1220,7 @@ input:checked + .slider:before {
position: relative;
z-index: 8;

margin-top: 2%;
margin-top: 1%;
}
.showExpertTable {
display: flex;
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
Loading