From 6a1ec6cb39cb13514156bf284b0acc388c6dbd63 Mon Sep 17 00:00:00 2001 From: NeoPlays <80448387+NeoPlays@users.noreply.github.com> Date: Fri, 11 Nov 2022 11:34:49 +0100 Subject: [PATCH] FIX: installpaths, stereum settings not cleaned, add mev to new installed services (#914) --- launcher/src/backend/NodeConnection.js | 8 +++++++- launcher/src/backend/ServiceManager.js | 19 ++++++++++++++----- .../backend/ethereum-services/NodeService.js | 4 ++-- launcher/src/background.js | 10 ++++++++++ .../components/UI/node-header/IconsNav.vue | 2 +- launcher/src/store/ControlService.js | 4 ++++ 6 files changed, 38 insertions(+), 9 deletions(-) diff --git a/launcher/src/backend/NodeConnection.js b/launcher/src/backend/NodeConnection.js index 56e20f8c3..065034e9d 100644 --- a/launcher/src/backend/NodeConnection.js +++ b/launcher/src/backend/NodeConnection.js @@ -24,6 +24,7 @@ export class NodeConnection { async establish(taskManager) { await this.sshService.connect(this.nodeConnectionParams); + await this.findStereumSettings() this.taskManager = taskManager; } @@ -753,7 +754,7 @@ export class NodeConnection { }); this.taskManager.finishedOtherTasks.push({ otherRunRef: ref }); - this.settings = undefined; + await this.logout() return "Node destroyed"; } @@ -980,5 +981,10 @@ export class NodeConnection { return resolve(settings); }); } + + async logout(){ + this.settings = undefined + await this.closeTunnels() + } } diff --git a/launcher/src/backend/ServiceManager.js b/launcher/src/backend/ServiceManager.js index 7b23eb5ff..804674154 100644 --- a/launcher/src/backend/ServiceManager.js +++ b/launcher/src/backend/ServiceManager.js @@ -180,12 +180,19 @@ export class ServiceManager { return service } - async modifyServices(tasks, services){ + async modifyServices(tasks, services, newInstallTasks){ let modifiedServices = [] tasks.forEach(task => { let service = services.find(s => s.id === task.service.config.serviceID) - let dependencies = task.data.executionClients.concat(task.data.beaconServices).map(s => services.find(e => e.id === s.config.serviceID)) + let dependencies = task.data.executionClients.concat(task.data.beaconServices).map(s => services.find(e => { + if(e.id === s.config.serviceID){ + return true + }else if(e.id === newInstallTasks.find(i => i.service.id === s.id).service.config.serviceID){ + return true + } + return false + })) if(service.service === "FlashbotsMevBoostService"){ service.entrypoint[service.entrypoint.findIndex(e => e === "-relays")+1] = task.data.relays @@ -622,6 +629,7 @@ export class ServiceManager { await Promise.all(newServices.map(async (service) => { await this.nodeConnection.writeServiceConfiguration(service.buildConfiguration()) })) + return ELInstalls.concat(CLInstalls,VLInstalls) } static uniqueByID(job) { @@ -641,16 +649,17 @@ export class ServiceManager { let after = this.nodeConnection.getTimeStamp() await this.nodeConnection.restartServices(after - before) } - } + } + let newInstallTasks if (jobs.includes("INSTALL")) { let services = await this.readServiceConfigurations() let installTasks = tasks.filter(t => t.content === "INSTALL") - await this.addServices(installTasks, services) + newInstallTasks = await this.addServices(installTasks, services) } if (jobs.includes("MODIFY")) { let services = await this.readServiceConfigurations() let modifyTasks = tasks.filter(t => t.content === "MODIFY") - await this.modifyServices(modifyTasks, services) + await this.modifyServices(modifyTasks, services, newInstallTasks) } } } \ No newline at end of file diff --git a/launcher/src/backend/ethereum-services/NodeService.js b/launcher/src/backend/ethereum-services/NodeService.js index 716770cd6..8f1f3d603 100644 --- a/launcher/src/backend/ethereum-services/NodeService.js +++ b/launcher/src/backend/ethereum-services/NodeService.js @@ -115,8 +115,8 @@ export class NodeService { buildWorkingDir (dir) { if(!dir) dir = '/opt/stereum' - dir = path.normalize(dir) - if(!path.isAbsolute(dir)) + dir = path.posix.normalize(dir) + if(!path.posix.isAbsolute(dir)) dir = '/' + dir if(dir.endsWith('/')) return dir.slice(0,-1,'') + '-' + this.id diff --git a/launcher/src/background.js b/launcher/src/background.js index 36725566e..57bedc5a5 100644 --- a/launcher/src/background.js +++ b/launcher/src/background.js @@ -117,6 +117,16 @@ promiseIpc.on("closeTunnels", async () => { return await nodeConnection.closeTunnels(); }); +promiseIpc.on("logout", async () => { + await taskManager.nodeConnection.logout(); + await monitoring.nodeConnection.logout(); + await monitoring.nodeConnectionProm.logout(); + await serviceManager.nodeConnection.logout(); + await monitoring.serviceManager.nodeConnection.logout(); + await monitoring.serviceManagerProm.nodeConnection.logout(); + return await nodeConnection.logout(); +}); + // called via promiseIpc as an async function promiseIpc.on("setApikey", async (arg) => { return stereumService.setApikey(arg); diff --git a/launcher/src/components/UI/node-header/IconsNav.vue b/launcher/src/components/UI/node-header/IconsNav.vue index 290166f12..440770284 100644 --- a/launcher/src/components/UI/node-header/IconsNav.vue +++ b/launcher/src/components/UI/node-header/IconsNav.vue @@ -129,7 +129,7 @@ export default { this.logoutModalIsActive = true; }, async loggingOut() { - await ControlService.closeTunnels(); + await ControlService.logout(); this.$router.push("/").then(() => { location.reload() }); diff --git a/launcher/src/store/ControlService.js b/launcher/src/store/ControlService.js index 5759135c8..d45c0e827 100644 --- a/launcher/src/store/ControlService.js +++ b/launcher/src/store/ControlService.js @@ -57,6 +57,10 @@ class ControlService extends EventEmitter { return await this.promiseIpc.send("closeTunnels"); } + async logout() { + return await this.promiseIpc.send("logout"); + } + async setApikey(args) { await this.promiseIpc.send("setApikey", args); }