Skip to content

Commit

Permalink
ADD: Holesky Testnet Support (stereum-dev#1429)
Browse files Browse the repository at this point in the history
* ADD: Holesky Testnet Support

* FIX: SSH Management bugs
  • Loading branch information
NeoPlays authored Sep 13, 2023
1 parent 121e4fd commit 9fdc0a9
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 9 deletions.
10 changes: 6 additions & 4 deletions launcher/src/backend/SSHService.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ export class SSHService {
}

async generateSSHKeyPair(opts = {}) {
const path = require("path");
if (opts.pickPath.endsWith("/")) opts.pickPath = opts.pickPath.slice(0, -1, ""); //if path ends with '/' remove it
try {

Expand Down Expand Up @@ -296,8 +297,9 @@ export class SSHService {
if (keyPair.public) {
let allKeys = [...exitingKeys, keyPair.public]
await this.writeSSHKeyFile(allKeys)
await writeFile(`${opts.pickPath}/${opts.keyType.toLowerCase()}`, keyPair.private)
await writeFile(`${opts.pickPath}/${opts.keyType.toLowerCase()}.pub`, keyPair.public)
const savePath = path.join(opts.pickPath, opts.keyType.toLowerCase())
await writeFile(savePath, keyPair.private)
await writeFile(savePath + ".pub", keyPair.public)
return allKeys
}
return exitingKeys
Expand All @@ -306,7 +308,7 @@ export class SSHService {
}
}

async readSSHKeyFile(path = `/home/${this.connectionInfo.user}/.ssh`) {
async readSSHKeyFile(path = `~/.ssh`) {
let authorizedKeys = []
try {
if (path.endsWith("/")) path = path.slice(0, -1, ""); //if path ends with '/' remove it
Expand All @@ -322,7 +324,7 @@ export class SSHService {
return authorizedKeys;
}

async writeSSHKeyFile(keys = [], path = `/home/${this.connectionInfo.user}/.ssh`) {
async writeSSHKeyFile(keys = [], path = `~/.ssh`) {
try {
if (path.endsWith("/")) path = path.slice(0, -1, ""); //if path ends with '/' remove it
let newKeys = keys.join("\n")
Expand Down
8 changes: 4 additions & 4 deletions launcher/src/backend/ServiceManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -1218,12 +1218,12 @@ export class ServiceManager {
}
if (service.service === "FlashbotsMevBoostService") {
command = service.entrypoint;
let index = command.findIndex((c) => /^-(mainnet|prater|goerli$)/.test(c));
let index = command.findIndex((c) => /^-(mainnet|prater|goerli|sepolia|holesky$)/.test(c));
command[index] = "-" + newNetwork;
index = command.findIndex((c) => c === "-relays") + 1;
command[index] = '""';
} else if (service.service === "PrysmBeaconService") {
let index = command.findIndex((c) => /--(mainnet|prater|goerli)/.test(c));
let index = command.findIndex((c) => /--(mainnet|prater|goerli|sepolia|holesky)/.test(c));
command[index] = "--" + newNetwork;
if (newNetwork === "mainnet" && command.includes("--genesis-state=/opt/app/genesis/prysm-prater-genesis.ssz")) {
command.splice(command.indexOf("--genesis-state=/opt/app/genesis/prysm-prater-genesis.ssz"), 1);
Expand All @@ -1235,8 +1235,8 @@ export class ServiceManager {
}
} else {
command = command.map((c) => {
if (/mainnet|prater|goerli/.test(c)) {
c = c.replace(/mainnet|prater|goerli/, newNetwork);
if (/mainnet|prater|goerli|sepolia|holesky/.test(c)) {
c = c.replace(/mainnet|prater|goerli|sepolia|holesky/, newNetwork);
}
return c;
});
Expand Down
2 changes: 1 addition & 1 deletion launcher/src/backend/ValidatorAccountManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ export class ValidatorAccountManager {
await this.nodeConnection.sshService.exec(
`chown 2000:2000 ${validatorsDir}/${pubkey}/exit_password.txt && chmod 700 ${validatorsDir}/${pubkey}/exit_password.txt`
);
const exitNimbusCmd = `docker run -v ${validatorsDir}:/validators --network=stereum sigp/lighthouse:latest lighthouse account validator exit --keystore=/validators/${pubkey}/keystore.json --password-file=/validators/${pubkey}/exit_password.txt --network=goerli --beacon-node=${client.dependencies.consensusClients[0] ? client.dependencies.consensusClients[0].buildConsensusClientHttpEndpointUrl() : "http:stereum-" + client.id + ":5052"} --no-confirmation`;
const exitNimbusCmd = `docker run -v ${validatorsDir}:/validators --network=stereum sigp/lighthouse:latest lighthouse account validator exit --keystore=/validators/${pubkey}/keystore.json --password-file=/validators/${pubkey}/exit_password.txt --network=${client.network} --beacon-node=${client.dependencies.consensusClients[0] ? client.dependencies.consensusClients[0].buildConsensusClientHttpEndpointUrl() : "http:stereum-" + client.id + ":5052"} --no-confirmation`;
result = await this.nodeConnection.sshService.exec(exitNimbusCmd);
await this.nodeConnection.sshService.exec(
`rm ${validatorsDir}/${pubkey}/exit_password.txt`
Expand Down
4 changes: 4 additions & 0 deletions launcher/src/backend/ethereum-services/NodeService.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export const networks = {
sepolia: {
name: "sepolia",
dataEndpoint: "https://sepolia.beaconcha.in/api/v1",
},
holesky: {
name: "holesky",
dataEndpoint: "https://holesky.beaconcha.in/api/v1",
}
};

Expand Down
1 change: 1 addition & 0 deletions launcher/src/components/UI/node-manage/SidebarManage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export default {
case "goerli":
return (item) => this.archFilter(item.service);
case "sepolia":
case "holesky":
return (item) => item.service != "SSVNetworkService" && this.archFilter(item.service);
case "gnosis":
return (item) =>
Expand Down
1 change: 1 addition & 0 deletions launcher/src/store/clickInstallation.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ export const useClickInstall = defineStore("clickInstallation", {
url: "https://checkpoint.gnosischain.com/",
},
],
holesky: [],
};
},
actions: {},
Expand Down
9 changes: 9 additions & 0 deletions launcher/src/store/nodeManage.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,15 @@ export const useNodeManage = defineStore("nodeManage", {
dataEndpoint: "https://beacon.gnosischain.com/api/v1",
support: ["staking", "stereum on arm"],
},
{
id: 5,
name: "Holesky Testnet",
network: "holesky",
icon: "/img/icon/click-installation/testnet-icon.png",
currencyIcon: "/img/icon/control/goETH_Currency_Symbol.png",
dataEndpoint: "https://holesky.beaconcha.in/api/v1",
support: ["staking", "stereum on arm", "mev boost"],
},
],
currentNetwork: {},
configNetwork: {},
Expand Down

0 comments on commit 9fdc0a9

Please sign in to comment.