Skip to content

Commit

Permalink
ADD: lido csm preset (#1927)
Browse files Browse the repository at this point in the history
* ADD: staking csm preset

* REFACTOR: revert thecarousel to avoid merge conflict

* FIX: modify kapi via edit node
  • Loading branch information
daverolo authored Jul 5, 2024
1 parent 9081c44 commit 55efd0a
Show file tree
Hide file tree
Showing 13 changed files with 231 additions and 192 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions launcher/src/backend/OneClickInstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,17 @@ export class OneClickInstall {
this.extraServices.push(this.serviceManager.getService("NotificationService", args));
}

if (constellation.includes("KeysAPIService")) {
//KeysAPIService
this.extraServices.push(
this.serviceManager.getService("KeysAPIService", {
...args,
consensusClients: [this.beaconService],
executionClients: [this.executionClient],
})
);
}

if (constellation.includes("ValidatorEjectorService")) {
//ValidatorEjectorService
this.extraServices.push(
Expand Down Expand Up @@ -410,6 +421,7 @@ export class OneClickInstall {
);
await this.serviceManager.createKeystores(this.needsKeystore);
await this.serviceManager.prepareSSVDKG(this.extraServices.find((s) => s.service === "SSVDKGService"));
await this.serviceManager.initKeysAPI(this.extraServices.filter((s) => s.service === "KeysAPIService"));
return configs;
}
}
Expand Down Expand Up @@ -503,6 +515,9 @@ export class OneClickInstall {
break;
case "lidossv":
services.push("SSVNetworkService", "SSVDKGService");
break;
case "lidocsm":
services.push("FlashbotsMevBoostService", "KeysAPIService", "ValidatorEjectorService");
}
return services;
}
Expand Down
24 changes: 23 additions & 1 deletion launcher/src/backend/ServiceManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,28 @@ export class ServiceManager {
(d) => typeof d.buildConsensusClientHttpEndpointUrl === "function"
);
return service;
case "KeysAPI":
// create a new function to handle dependencies for env vars
keyValuePairs = [
{
key: "PROVIDERS_URLS",
value: (e) => e.buildExecutionClientHttpEndpointUrl(),
filter: (d) => typeof d.buildExecutionClientHttpEndpointUrl === "function",
},
{
key: "CL_API_URLS",
value: (e) => e.buildConsensusClientHttpEndpointUrl(),
filter: (d) => typeof d.buildConsensusClientHttpEndpointUrl === "function",
},
];
this.addENVConnction(service, dependencies, keyValuePairs);
service.dependencies.executionClients = dependencies.filter(
(d) => typeof d.buildExecutionClientHttpEndpointUrl === "function"
);
service.dependencies.consensusClients = dependencies.filter(
(d) => typeof d.buildConsensusClientHttpEndpointUrl === "function"
);
return service;
default:
return service;
}
Expand Down Expand Up @@ -1032,7 +1054,7 @@ export class ServiceManager {

case "KeysAPIService":
ports = [new ServicePort("127.0.0.1", 3600, 3600, servicePortProtocol.tcp)];
return KeysAPIService.buildByUserInput(args.network, ports);
return KeysAPIService.buildByUserInput(args.network, ports, args.executionClients, args.consensusClients);

case "SSVNetworkService":
ports = [
Expand Down
150 changes: 80 additions & 70 deletions launcher/src/backend/ethereum-services/KeysAPIService.js
Original file line number Diff line number Diff line change
@@ -1,74 +1,84 @@
import { NodeService } from "./NodeService";

export class KeysAPIService extends NodeService {
static buildByUserInput(network, ports) {
const service = new KeysAPIService();
service.setId();

const image = "lidofinance/lido-keys-api";

service.init(
"KeysAPIService",
service.id, // id
1, // configVersion
image, // image
"dev", // imageVersion
[], // command
[], // entrypoint
{
// App
PORT: "3600",

// The number of seconds that each request will last in storage
GLOBAL_THROTTLE_TTL: "5",

// The maximum number of requests within the TTL limit
GLOBAL_THROTTLE_LIMIT: "100",

// Cache expiration time in seconds
GLOBAL_CACHE_TTL: "1",


// Log level: debug, info, notice, warning or error
LOG_LEVEL: "info",

// Log format: simple or json
LOG_FORMAT: "simple",
PROVIDERS_URLS: "http://your_el_node1,http://your_el_node2",
// chain id
// for mainnet 1
// for testnet 5
CHAIN_ID: network == "mainnet" ? "1" : "5",

DB_NAME: "node_operator_keys_service_db",
DB_PORT: "5432",
DB_HOST: "localhost",
DB_USER: "postgres",
DB_PASSWORD: "postgres",

// It is possible to enable/disable collecting of validators
// value below is default
VALIDATOR_REGISTRY_ENABLE: "true",

// CL api urls
// if VALIDATOR_REGISTRY_ENABLE=false , there are no need to provide CL_API_URLS
CL_API_URLS: "http://your_cl_node1,http://your_cl_node2"
}, // env
ports, // ports
[], // volumes
null, // user
network // network
// executionClients
// consensusClients
);
return service;
}

static buildByConfiguration(config) {
const service = new KeysAPIService();

service.initByConfig(config);

return service;
}
static buildByUserInput(network, ports, executionClients, consensusClients) {
const service = new KeysAPIService();
service.setId();

const image = "lidofinance/lido-keys-api";

service.init(
"KeysAPIService",
service.id, // id
1, // configVersion
image, // image
"dev", // imageVersion
[], // command
[], // entrypoint
{
// App
PORT: "3600",

// The number of seconds that each request will last in storage
GLOBAL_THROTTLE_TTL: "5",

// The maximum number of requests within the TTL limit
GLOBAL_THROTTLE_LIMIT: "100",

// Cache expiration time in seconds
GLOBAL_CACHE_TTL: "1",

// Log level: debug, info, notice, warning or error
LOG_LEVEL: "info",

// Log format: simple or json
LOG_FORMAT: "simple",

PROVIDERS_URLS: executionClients[0]
? executionClients[0].buildExecutionClientHttpEndpointUrl()
: "http://your_el_node1,http://your_el_node2",

// chain id
// for mainnet 1
// for testnet 17000
CHAIN_ID: network == "mainnet" ? "1" : "17000",

DB_NAME: "node_operator_keys_service_db",
DB_PORT: "5432",
DB_HOST: "localhost",
DB_USER: "postgres",
DB_PASSWORD: "postgres",

// It is possible to enable/disable collecting of validators
// value below is default
VALIDATOR_REGISTRY_ENABLE: "true",

// CL api urls
// if VALIDATOR_REGISTRY_ENABLE=false , there are no need to provide CL_API_URLS
CL_API_URLS: consensusClients[0]
? consensusClients[0].buildConsensusClientHttpEndpointUrl()
: "http://your_cl_node1,http://your_cl_node2",
}, // env
ports, // ports
[], // volumes
null, // user
// network // network
// // executionClients
// // consensusClients
network, // network
executionClients[0] ? [executionClients[0]] : [], // executionClients
consensusClients[0] ? [consensusClients[0]] : [], // consensusClients
[], // MevBoost
[] // otherServices
);
return service;
}

static buildByConfiguration(config) {
const service = new KeysAPIService();

service.initByConfig(config);

return service;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ export class ValidatorEjectorService extends NodeService {
let oracleAllowList = '["0x0000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000"]';
switch (network) {
case "mainnet":
locatorAddress = "0xC1d0b3DE6792Bf6b4b37EccdcC24e45978Cfd2Eb" //https://docs.lido.fi/deployed-contracts/#core-protocol
oracleAllowList = '["0x140Bd8FbDc884f48dA7cb1c09bE8A2fAdfea776E","0xA7410857ABbf75043d61ea54e07D57A6EB6EF186","0x404335BcE530400a5814375E7Ec1FB55fAff3eA2","0x946D3b081ed19173dC83Cd974fC69e1e760B7d78","0x007DE4a5F7bc37E2F26c0cb2E8A95006EE9B89b5","0xEC4BfbAF681eb505B94E4a7849877DC6c600Ca3A","0x61c91ECd902EB56e314bB2D5c5C07785444Ea1c8","0x1Ca0fEC59b86F549e1F1184d97cb47794C8Af58d","0xc79F702202E3A6B0B6310B537E786B9ACAA19BAf"]'
locatorAddress = "0xC1d0b3DE6792Bf6b4b37EccdcC24e45978Cfd2Eb"; //https://docs.lido.fi/deployed-contracts/#core-protocol
oracleAllowList =
'["0x140Bd8FbDc884f48dA7cb1c09bE8A2fAdfea776E","0xA7410857ABbf75043d61ea54e07D57A6EB6EF186","0x404335BcE530400a5814375E7Ec1FB55fAff3eA2","0x946D3b081ed19173dC83Cd974fC69e1e760B7d78","0x007DE4a5F7bc37E2F26c0cb2E8A95006EE9B89b5","0xEC4BfbAF681eb505B94E4a7849877DC6c600Ca3A","0x61c91ECd902EB56e314bB2D5c5C07785444Ea1c8","0x1Ca0fEC59b86F549e1F1184d97cb47794C8Af58d","0xc79F702202E3A6B0B6310B537E786B9ACAA19BAf"]';
break;
case "holesky":
locatorAddress = "0x28FAB2059C713A7F9D8c86Db49f9bb0e96Af1ef8" //https://docs.lido.fi/deployed-contracts/holesky#core-protocol
oracleAllowList = '["0x12A1D74F8697b9f4F1eEBb0a9d0FB6a751366399", "0xD892c09b556b547c80B7d8c8cB8d75bf541B2284", "0xf7aE520e99ed3C41180B5E12681d31Aa7302E4e5", "0x31fa51343297FFce0CC1E67a50B2D3428057D1b1", "0x81E411f1BFDa43493D7994F82fb61A415F6b8Fd4", "0x4c75FA734a39f3a21C57e583c1c29942F021C6B7", "0xD3b1e36A372Ca250eefF61f90E833Ca070559970", "0xF0F23944EfC5A63c53632C571E7377b85d5E6B6f", "0xb29dD2f6672C0DFF2d2f173087739A42877A5172", "0x3799bDA7B884D33F79CEC926af21160dc47fbe05"]'
locatorAddress = "0x28FAB2059C713A7F9D8c86Db49f9bb0e96Af1ef8"; //https://docs.lido.fi/deployed-contracts/holesky#core-protocol
oracleAllowList =
'["0x12A1D74F8697b9f4F1eEBb0a9d0FB6a751366399", "0xD892c09b556b547c80B7d8c8cB8d75bf541B2284", "0xf7aE520e99ed3C41180B5E12681d31Aa7302E4e5", "0x31fa51343297FFce0CC1E67a50B2D3428057D1b1", "0x81E411f1BFDa43493D7994F82fb61A415F6b8Fd4", "0x4c75FA734a39f3a21C57e583c1c29942F021C6B7", "0xD3b1e36A372Ca250eefF61f90E833Ca070559970", "0xF0F23944EfC5A63c53632C571E7377b85d5E6B6f", "0xb29dD2f6672C0DFF2d2f173087739A42877A5172", "0x3799bDA7B884D33F79CEC926af21160dc47fbe05"]';
break;
case "sepolia":
locatorAddress = "0x8f6254332f69557A72b0DA2D5F0Bc07d4CA991E7" //https://docs.lido.fi/deployed-contracts/sepolia#core-protocol
locatorAddress = "0x8f6254332f69557A72b0DA2D5F0Bc07d4CA991E7"; //https://docs.lido.fi/deployed-contracts/sepolia#core-protocol
break;
default:
break;
Expand All @@ -42,8 +44,8 @@ export class ValidatorEjectorService extends NodeService {
EXECUTION_NODE: executionClients[0] ? executionClients[0].buildExecutionClientHttpEndpointUrl() : "",
CONSENSUS_NODE: consensusClients[0] ? consensusClients[0].buildConsensusClientHttpEndpointUrl() : "",
LOCATOR_ADDRESS: locatorAddress,
STAKING_MODULE_ID: "123",
OPERATOR_ID: "123",
STAKING_MODULE_ID: "1",
OPERATOR_ID: "123456789",
MESSAGES_LOCATION: "/app/messages",
ORACLE_ADDRESSES_ALLOWLIST: oracleAllowList,
HTTP_PORT: "8989",
Expand Down
Loading

0 comments on commit 55efd0a

Please sign in to comment.