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: Prysm Migration #2124

Merged
merged 5 commits into from
Dec 4, 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
107 changes: 107 additions & 0 deletions controls/roles/update-changes/molecule/224/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,111 @@
mevboost: []
otherServices: []
become: yes

- name: Create PrysmBeaconService config
copy:
dest: "/etc/stereum/services/d545b944-56d5-dd8f-e6d7-51ad6ecfe7b2.yaml"
owner: "root"
group: "root"
mode: 0644
content: |
service: PrysmBeaconService
id: d545b944-56d5-dd8f-e6d7-51ad6ecfe7b2
configVersion: 1
command:
- --accept-terms-of-use=true
- --holesky
- --datadir=/opt/app/beacon
- --block-batch-limit=512
- --rpc-host=0.0.0.0
- --grpc-gateway-host=0.0.0.0
- --p2p-max-peers=100
- --execution-endpoint=http://stereum-54c64310-1cf4-bea6-e539-b775393e2eb2:8551
- --grpc-gateway-port=3500
- --grpc-gateway-host=0.0.0.0
- --grpc-gateway-corsdomain="*"
- --jwt-secret=/engine.jwt
- --monitoring-host=0.0.0.0
- --monitoring-port=8080
- --p2p-tcp-port=13001
- --p2p-udp-port=12001
- --genesis-state=/opt/app/genesis/prysm-holesky-genesis.ssz
- --checkpoint-sync-url=https://checkpoint-sync.holesky.ethpandaops.io
entrypoint:
- /app/cmd/beacon-chain/beacon-chain
env: {}
image: prysmaticlabs/prysm-beacon-chain:v5.1.2
ports:
- 0.0.0.0:13001:13001/tcp
- 0.0.0.0:12001:12001/udp
- 127.0.0.1:4000:4000/tcp
- 127.0.0.1:3500:3500/tcp
volumes:
- /opt/stereum/prysm-d545b944-56d5-dd8f-e6d7-51ad6ecfe7b2/beacon:/opt/app/beacon
- /opt/stereum/prysm-d545b944-56d5-dd8f-e6d7-51ad6ecfe7b2/genesis:/opt/app/genesis
- /opt/stereum/nethermind-54c64310-1cf4-bea6-e539-b775393e2eb2/engine.jwt:/engine.jwt
user: "2000"
autoupdate: true
network: holesky
dependencies:
executionClients:
- service: NethermindService
id: 54c64310-1cf4-bea6-e539-b775393e2eb2
consensusClients: []
mevboost: []
otherServices: []
become: yes

- name: Create PrysmValidatorService config
copy:
dest: "/etc/stereum/services/0f8ae6ed-4fb1-ad08-7219-9078373f957b.yaml"
owner: "root"
group: "root"
mode: 0644
content: |
service: PrysmValidatorService
id: 0f8ae6ed-4fb1-ad08-7219-9078373f957b
configVersion: 1
command:
- --accept-terms-of-use=true
- --beacon-rpc-provider=stereum-d545b944-56d5-dd8f-e6d7-51ad6ecfe7b2:4000
- --beacon-rpc-gateway-provider=stereum-d545b944-56d5-dd8f-e6d7-51ad6ecfe7b2:3500,stereum-d545b944-56d5-dd8f-e6d7-51ad6ecfe7b2:3500,stereum-d545b944-56d5-dd8f-e6d7-51ad6ecfe7b2:3500,
- --web
- --holesky
- --datadir=/opt/app/data/db
- --keymanager-token-file=/opt/app/data/wallets/auth-token
- --wallet-dir=/opt/app/data/wallets
- --wallet-password-file=/opt/app/data/passwords/wallet-password
- --monitoring-host=0.0.0.0
- --grpc-gateway-port=7500
- --grpc-gateway-host=0.0.0.0
- --grpc-gateway-corsdomain="*"
- --monitoring-host=0.0.0.0
- --monitoring-port=8081
- --suggested-fee-recipient=0x0000000000000000000000000000000000000000
- --graffiti-file=/opt/app/graffitis/graffitis.yaml
- --enable-builder=true
- --enable-doppelganger=true
entrypoint:
- /app/cmd/validator/validator
env: {}
image: prysmaticlabs/prysm-validator:v5.1.2
ports:
- 127.0.0.1:7500:7500/tcp
volumes:
- /opt/stereum/prysm-0f8ae6ed-4fb1-ad08-7219-9078373f957b/data/db:/opt/app/data/db
- /opt/stereum/prysm-0f8ae6ed-4fb1-ad08-7219-9078373f957b/data/wallets:/opt/app/data/wallets
- /opt/stereum/prysm-0f8ae6ed-4fb1-ad08-7219-9078373f957b/data/passwords:/opt/app/data/passwords
- /opt/stereum/prysm-0f8ae6ed-4fb1-ad08-7219-9078373f957b/graffitis:/opt/app/graffitis
user: "2000"
autoupdate: true
network: holesky
dependencies:
executionClients: []
consensusClients:
- service: PrysmBeaconService
id: d545b944-56d5-dd8f-e6d7-51ad6ecfe7b2
mevboost: []
otherServices: []
become: yes
#EOF
29 changes: 29 additions & 0 deletions controls/roles/update-changes/molecule/224/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,24 @@
src: "/etc/stereum/services/41b15ea7-12d4-49f6-8448-8a6164edef36.yaml"
register: Ejector_service_configuration2_raw

# PrysmBeaconService
- name: Read PrysmBeaconService file
slurp:
src: "/etc/stereum/services/d545b944-56d5-dd8f-e6d7-51ad6ecfe7b2.yaml"
register: PrysmBeacon_service_configuration_raw

# PrysmValidatorService
- name: Read PrysmValidatorService file
slurp:
src: "/etc/stereum/services/0f8ae6ed-4fb1-ad08-7219-9078373f957b.yaml"
register: PrysmValdiator_service_configuration_raw

- name: Parse Service configurations
set_fact:
Ejector_service_configuration: "{{ Ejector_service_configuration_raw['content'] | b64decode | from_yaml }}"
Ejector_service_configuration2: "{{ Ejector_service_configuration2_raw['content'] | b64decode | from_yaml }}"
PrysmBeacon_service_configuration: "{{ PrysmBeacon_service_configuration_raw['content'] | b64decode | from_yaml }}"
PrysmValdiator_service_configuration: "{{ PrysmValdiator_service_configuration_raw['content'] | b64decode | from_yaml }}"

- debug:
msg: "{{ Ejector_service_configuration }}"
Expand All @@ -30,10 +44,25 @@
- debug:
msg: "{{ Ejector_service_configuration2_raw['content'] | b64decode }}"

- debug:
msg: "{{ PrysmBeacon_service_configuration }}"
- debug:
msg: "{{ PrysmBeacon_service_configuration_raw['content'] | b64decode }}"

- debug:
msg: "{{ PrysmValdiator_service_configuration }}"
- debug:
msg: "{{ PrysmValdiator_service_configuration_raw['content'] | b64decode }}"

- assert:
that:
- Ejector_service_configuration.env.ORACLE_ADDRESSES_ALLOWLIST | from_yaml | select('match', '0x73181107c8D9ED4ce0bbeF7A0b4ccf3320C41d12') | length == 1
- Ejector_service_configuration.env.ORACLE_ADDRESSES_ALLOWLIST | from_yaml | select('match', '0x1Ca0fEC59b86F549e1F1184d97cb47794C8Af58d') | length == 0
- Ejector_service_configuration2.env.ORACLE_ADDRESSES_ALLOWLIST | from_yaml | select('match', '0x73181107c8D9ED4ce0bbeF7A0b4ccf3320C41d12') | length == 1
- Ejector_service_configuration2.env.ORACLE_ADDRESSES_ALLOWLIST | from_yaml | select('match', '0x1Ca0fEC59b86F549e1F1184d97cb47794C8Af58d') | length == 0
- PrysmBeacon_service_configuration.command | select('match', 'grpc-gateway') | length == 0
- PrysmValdiator_service_configuration.command | select('match', 'grpc-gateway') | length == 0
- PrysmValdiator_service_configuration.command | select('match', '--beacon-rest-api-provider') | length == 1
- PrysmValdiator_service_configuration.command | select('match', '--enable-beacon-rest-api') | length == 1
- PrysmValdiator_service_configuration.command | select('match', '--beacon-rpc-gateway-provider') | length == 0
# EOF
53 changes: 53 additions & 0 deletions controls/roles/update-changes/tasks/2.2.4/prysm_changes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
- name: Read service file
slurp:
src: "{{ config_file.path }}"
register: service_configuration_raw

- name: Parse service's configuration
set_fact:
service_configuration: "{{ service_configuration_raw['content'] | b64decode | from_yaml }}"
service_configuration_text: "{{ service_configuration_raw['content'] | b64decode }}"

- name: Update PrysmBeacon Changes
when: service_configuration.service == "PrysmBeaconService" or service_configuration.service == "PrysmValidatorService"
block:
- name: Update grpc-gateway-corsdomain
replace:
path: "{{ config_file.path }}"
regexp: "--grpc-gateway-corsdomain"
replace: "--http-cors-domain"

- name: Update grpc-gateway* to http*
replace:
path: "{{ config_file.path }}"
regexp: "--grpc-gateway"
replace: "--http"

- name: Update ports
lineinfile:
path: "{{ config_file.path }}"
regexp: "[0-9]{1,3}:[0-9]{1,5}:4000"
state: absent
when:
- service_configuration.service == "PrysmBeaconService"

- name: Update PrysmValidator Changes
when: service_configuration.service == "PrysmValidatorService"
block:
- name: get urls
when: service_configuration.command | select('match', '--beacon-rpc-gateway-provider') | length > 0
set_fact:
urls: "{{ service_configuration.command | select('match', '--beacon-rpc-gateway-provider') | first | regex_replace('^--beacon-rpc-gateway-provider[= ]', '') | split(',') | reject('equalto', '') | map('regex_replace', '^(.*)$', 'http://\\1') | join(',') }}"

- name: Update beacon-rpc-gateway-provider
replace:
path: "{{ config_file.path }}"
regexp: "--beacon-rpc-gateway-provider.*"
replace: "--beacon-rest-api-provider={{ urls | default('') }}"

- name: Add enable-beacon-rest-api
replace:
path: "{{ config_file.path }}"
regexp: "--beacon-rpc-provider.*"
replace: "--enable-beacon-rest-api"
6 changes: 6 additions & 0 deletions controls/roles/update-changes/tasks/2.2.4/updates-224.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@
loop: "{{ service_config_files.files }}"
loop_control:
loop_var: config_file

- name: Include Prysm Changes
include_tasks: prysm_changes.yaml
loop: "{{ service_config_files.files }}"
loop_control:
loop_var: config_file
5 changes: 5 additions & 0 deletions launcher/src/backend/SSHService.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export class SSHService {
}, 100);
this.shellConn = null;
this.shellStream = null;
this.loggingOut = false;
}

static checkExecError(err, accept_empty_result = false) {
Expand Down Expand Up @@ -184,6 +185,7 @@ export class SSHService {

async disconnect(reconnecting = false) {
log.info("DISCONNECT: connectionInfo", this.connectionInfo.host);
this.loggingOut = true;
try {
this.connected = false;
if (!reconnecting) {
Expand Down Expand Up @@ -212,6 +214,8 @@ export class SSHService {
return true;
} catch (error) {
return error;
} finally {
this.loggingOut = false;
}
}

Expand All @@ -221,6 +225,7 @@ export class SSHService {
}

async execCommand(command) {
if (this.loggingOut) return { rc: -1, stdout: "", stderr: "Logging Out!" };
return new Promise((resolve, reject) => {
let conn = this.getConnectionFromPool();

Expand Down
33 changes: 12 additions & 21 deletions launcher/src/backend/ServiceManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,16 @@ export class ServiceManager {
command = "--execution-endpoint=";
}
if (service.service.includes("Validator")) {
filter = (e) => e.buildConsensusClientEndpoint();
command = "--beacon-rpc-provider=";
service.command = this.addCommandConnection(service, command, dependencies, filter);
filter = (e) => e.buildConsensusClientGateway();
command = "--beacon-rpc-gateway-provider=";
if (!service.command.includes("--enable-beacon-rest-api")) {
filter = (e) => e.buildConsensusClientEndpoint();
command = "--beacon-rpc-provider=";
service.command = this.addCommandConnection(service, command, dependencies, filter);
filter = (e) => e.buildConsensusClientGateway();
command = "--beacon-rpc-gateway-provider=";
} else {
filter = (e) => e.buildConsensusClientHttpEndpointUrl();
command = "--beacon-rest-api-provider=";
}
}
break;
case "Lodestar":
Expand Down Expand Up @@ -683,12 +688,6 @@ export class ServiceManager {
.join();
}
}
if (service.service.includes("PrysmValidator") && serviceToDelete.service.includes("ExternalConsensus")) {
service.command = this.removeCommandConnection(
service.command,
serviceToDelete.env.gateway ? serviceToDelete.env.gateway : "--beacon-rpc-gateway-provider="
);
}

//update volumes
service.volumes = service.volumes.filter((v) => !v.destinationPath.includes(serviceToDelete.id));
Expand Down Expand Up @@ -1067,12 +1066,7 @@ export class ServiceManager {
return ExternalExecutionService.buildByUserInput(args.network, args.installDir + "/externalExecution", args.source, args.jwtToken);
case "ExternalConsensusService":
ports = [];
return ExternalConsensusService.buildByUserInput(
args.network,
args.installDir + "/externalConsensus",
args.source,
args.gateway ? args.gateway : ""
);
return ExternalConsensusService.buildByUserInput(args.network, args.installDir + "/externalConsensus", args.source);
case "CustomService":
ports = [];
return CustomService.buildByUserInput(
Expand Down Expand Up @@ -1235,10 +1229,7 @@ export class ServiceManager {
.destinationPath.split("/")
.slice(0, -1)
.join("/");
await this.nodeConnection.sshService.exec(
`mkdir -p ${extConnDir} && echo -e ${service.env.link} > ${extConnDir}/link.txt` +
(service.env.gateway ? ` && echo -e ${service.env.gateway} > ${extConnDir}/gateway.txt` : "")
);
await this.nodeConnection.sshService.exec(`mkdir -p ${extConnDir} && echo -e ${service.env.link} > ${extConnDir}/link.txt`);
if (service.service.includes("Execution")) {
await this.nodeConnection.sshService.exec(`echo -e ${service.env.jwtToken} > ${extConnDir}/engine.jwt`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ import { NodeService } from "./NodeService";
import { ServiceVolume } from "./ServiceVolume";

export class ExternalConsensusService extends NodeService {
static buildByUserInput(network, dir, source, gateway) {
static buildByUserInput(network, dir, source) {
const service = new ExternalConsensusService();
service.setId();

const workingDir = service.buildWorkingDir(dir);
const volumes = [
new ServiceVolume(workingDir + "/link.txt", ""),
...(gateway ? [new ServiceVolume(workingDir + "/gateway.txt", "")] : []),
];
const volumes = [new ServiceVolume(workingDir + "/link.txt", "")];
service.init(
"ExternalConsensusService", // service
service.id, // id
Expand All @@ -19,7 +16,7 @@ export class ExternalConsensusService extends NodeService {
null, // imageVersion
[], // command
[], // entrypoint
gateway ? { link: source, gateway: gateway } : { link: source }, // env
{ link: source }, // env
[], // ports
volumes, // volumes
null, // user
Expand Down
11 changes: 0 additions & 11 deletions launcher/src/backend/ethereum-services/NethermindService.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,6 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class PrysmBeaconService extends NodeService {
"--accept-terms-of-use=true",
`--datadir=${dataDir}`,
"--rpc-host=0.0.0.0",
"--grpc-gateway-host=0.0.0.0",
"--http-host=0.0.0.0",
`--execution-endpoint=${executionEndpoint}`,
`--jwt-secret=${JWTDir}`,
"--monitoring-host=0.0.0.0",
Expand Down
Loading