Skip to content

Commit 4727618

Browse files
authoredSep 11, 2024
FIX: Integartion tests, improve disconnect (stereum-dev#2045)
* IMPROVE: Disconnecting all SSH Sessions * FIX: Integration Tests * ADD: Lido Mainnet Oracle Allowlist Changes
1 parent f27ca24 commit 4727618

File tree

13 files changed

+231
-5
lines changed

13 files changed

+231
-5
lines changed
 

‎.github/workflows/test-molecule.yml

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ jobs:
7171
{ role: "update-changes", test: "215" },
7272
{ role: "update-changes", test: "221" },
7373
{ role: "update-changes", test: "222" },
74+
{ role: "update-changes", test: "223" },
7475
]
7576
fail-fast: false
7677
concurrency: molecule-test-${{ matrix.tests.role }}-${{ matrix.tests.test }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
- name: Converge
3+
hosts: all
4+
vars_files:
5+
- ../../../../defaults/stereum_defaults.yaml
6+
7+
tasks:
8+
- name: "Include update-changes"
9+
include_role:
10+
name: "update-changes"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
#dependency:
3+
# name: galaxy
4+
driver:
5+
name: docker
6+
platforms:
7+
- name: 'update-changes--2.2.3--ubuntu-23.04'
8+
image: ubuntu:lunar
9+
# - name: "configure-updates--default--centos-8"
10+
# image: geerlingguy/docker-centos8-ansible
11+
provisioner:
12+
name: ansible
13+
env:
14+
ANSIBLE_PIPELINING: 'True'
15+
lint: |
16+
set -e
17+
yamllint .
18+
ansible-lint .
19+
scenario:
20+
test_sequence:
21+
- destroy
22+
- create
23+
- prepare
24+
- converge
25+
- idempotence
26+
- verify
27+
- destroy
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
- name: Converge
3+
hosts: all
4+
tasks:
5+
- name: "Include update-changes"
6+
include_role:
7+
name: "update-changes"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
---
2+
- name: Prepare
3+
hosts: all
4+
tasks:
5+
- name: Make sure Stereum's config path exists
6+
file:
7+
path: '/etc/stereum/services'
8+
state: directory
9+
owner: 'root'
10+
group: 'root'
11+
mode: 0644
12+
become: yes
13+
14+
- name: Create ValidatorEjectorService config
15+
copy:
16+
dest: '/etc/stereum/services/15ce3684-4dbd-4657-8a21-b1243b72b1ca.yaml'
17+
owner: 'root'
18+
group: 'root'
19+
mode: 0644
20+
content: |
21+
service: ValidatorEjectorService
22+
id: 15ce3684-4dbd-4657-8a21-b1243b72b1ca
23+
configVersion: 1
24+
command: []
25+
entrypoint: []
26+
env:
27+
EXECUTION_NODE: http://stereum-ce456ae0-64d6-4886-a53b-6b90984d4913:8545
28+
CONSENSUS_NODE: http://stereum-e7bd77d1-4d20-4a2e-85a6-1915f105a4c6:5052
29+
LOCATOR_ADDRESS: "0x28FAB2059C713A7F9D8c86Db49f9bb0e96Af1ef8"
30+
STAKING_MODULE_ID: "123"
31+
OPERATOR_ID: "123"
32+
MESSAGES_LOCATION: /app/messages
33+
ORACLE_ADDRESSES_ALLOWLIST: '["0x140Bd8FbDc884f48dA7cb1c09bE8A2fAdfea776E",
34+
"0xA7410857ABbf75043d61ea54e07D57A6EB6EF186",
35+
"0x404335BcE530400a5814375E7Ec1FB55fAff3eA2",
36+
"0x946D3b081ed19173dC83Cd974fC69e1e760B7d78",
37+
"0x007DE4a5F7bc37E2F26c0cb2E8A95006EE9B89b5",
38+
"0xEC4BfbAF681eb505B94E4a7849877DC6c600Ca3A",
39+
"0x61c91ECd902EB56e314bB2D5c5C07785444Ea1c8",
40+
"0x1Ca0fEC59b86F549e1F1184d97cb47794C8Af58d",
41+
"0xc79F702202E3A6B0B6310B537E786B9ACAA19BAf"]'
42+
HTTP_PORT: "8989"
43+
RUN_METRICS: "true"
44+
RUN_HEALTH_CHECK: "true"
45+
DRY_RUN: "false"
46+
image: lidofinance/validator-ejector:1.6.0
47+
ports: []
48+
volumes:
49+
- /opt/stereum/validatorejector-15ce3684-4dbd-4657-8a21-b1243b72b1ca/messages:/app/messages
50+
user: "2000"
51+
autoupdate: true
52+
network: mainnet
53+
dependencies:
54+
executionClients:
55+
- service: GethService
56+
id: ce456ae0-64d6-4886-a53b-6b90984d4913
57+
consensusClients:
58+
- service: LighthouseBeaconService
59+
id: e7bd77d1-4d20-4a2e-85a6-1915f105a4c6
60+
mevboost: []
61+
otherServices: []
62+
become: yes
63+
64+
- name: Create ValidatorEjectorService config
65+
copy:
66+
dest: '/etc/stereum/services/41b15ea7-12d4-49f6-8448-8a6164edef36.yaml'
67+
owner: 'root'
68+
group: 'root'
69+
mode: 0644
70+
content: |
71+
service: ValidatorEjectorService
72+
id: 41b15ea7-12d4-49f6-8448-8a6164edef36
73+
configVersion: 1
74+
command: []
75+
entrypoint: []
76+
env:
77+
EXECUTION_NODE: http://stereum-cc1323ce-90a1-440f-8b78-f930a3300b38:8545
78+
CONSENSUS_NODE: http://stereum-62cb879b-b0f0-4ea2-bc13-f606b7f4cfb9:5052
79+
LOCATOR_ADDRESS: "0x28FAB2059C713A7F9D8c86Db49f9bb0e96Af1ef8"
80+
STAKING_MODULE_ID: "123"
81+
OPERATOR_ID: "123"
82+
MESSAGES_LOCATION: /app/messages
83+
ORACLE_ADDRESSES_ALLOWLIST: '["0x140Bd8FbDc884f48dA7cb1c09bE8A2fAdfea776E","0xA7410857ABbf75043d61ea54e07D57A6EB6EF186","0x404335BcE530400a5814375E7Ec1FB55fAff3eA2","0x946D3b081ed19173dC83Cd974fC69e1e760B7d78","0x007DE4a5F7bc37E2F26c0cb2E8A95006EE9B89b5","0xEC4BfbAF681eb505B94E4a7849877DC6c600Ca3A","0x61c91ECd902EB56e314bB2D5c5C07785444Ea1c8","0x1Ca0fEC59b86F549e1F1184d97cb47794C8Af58d","0xc79F702202E3A6B0B6310B537E786B9ACAA19BAf"]'
84+
HTTP_PORT: "8989"
85+
RUN_METRICS: "true"
86+
RUN_HEALTH_CHECK: "true"
87+
DRY_RUN: "false"
88+
image: lidofinance/validator-ejector:1.6.0
89+
ports: []
90+
volumes:
91+
- /opt/stereum/validatorejector-41b15ea7-12d4-49f6-8448-8a6164edef36/messages:/app/messages
92+
user: "2000"
93+
autoupdate: true
94+
network: mainnet
95+
dependencies:
96+
executionClients:
97+
- service: GethService
98+
id: cc1323ce-90a1-440f-8b78-f930a3300b38
99+
consensusClients:
100+
- service: LighthouseBeaconService
101+
id: 62cb879b-b0f0-4ea2-bc13-f606b7f4cfb9
102+
mevboost: []
103+
otherServices: []
104+
become: yes
105+
#EOF
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
- name: Verify
3+
hosts: all
4+
gather_facts: false
5+
tasks:
6+
# ValidatorEjectorService
7+
- name: Read ValidatorEjectorService file
8+
slurp:
9+
src: '/etc/stereum/services/15ce3684-4dbd-4657-8a21-b1243b72b1ca.yaml'
10+
register: Ejector_service_configuration_raw
11+
12+
# ValidatorEjectorService2
13+
- name: Read ValidatorEjectorService file
14+
slurp:
15+
src: '/etc/stereum/services/41b15ea7-12d4-49f6-8448-8a6164edef36.yaml'
16+
register: Ejector_service_configuration2_raw
17+
18+
- name: Parse Service configurations
19+
set_fact:
20+
Ejector_service_configuration: "{{ Ejector_service_configuration_raw['content'] | b64decode | from_yaml }}"
21+
Ejector_service_configuration2: "{{ Ejector_service_configuration2_raw['content'] | b64decode | from_yaml }}"
22+
23+
- debug:
24+
msg: '{{ Ejector_service_configuration }}'
25+
- debug:
26+
msg: "{{ Ejector_service_configuration_raw['content'] | b64decode }}"
27+
28+
- debug:
29+
msg: '{{ Ejector_service_configuration2 }}'
30+
- debug:
31+
msg: "{{ Ejector_service_configuration2_raw['content'] | b64decode }}"
32+
33+
- assert:
34+
that:
35+
- Ejector_service_configuration.env.ORACLE_ADDRESSES_ALLOWLIST | from_yaml | select('match', '0xe57B3792aDCc5da47EF4fF588883F0ee0c9835C9') | length == 1
36+
- Ejector_service_configuration.env.ORACLE_ADDRESSES_ALLOWLIST | from_yaml | select('match', '0xEC4BfbAF681eb505B94E4a7849877DC6c600Ca3A') | length == 0
37+
- Ejector_service_configuration2.env.ORACLE_ADDRESSES_ALLOWLIST | from_yaml | select('match', '0xe57B3792aDCc5da47EF4fF588883F0ee0c9835C9') | length == 1
38+
- Ejector_service_configuration2.env.ORACLE_ADDRESSES_ALLOWLIST | from_yaml | select('match', '0xEC4BfbAF681eb505B94E4a7849877DC6c600Ca3A') | length == 0
39+
# EOF
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
- name: Read service file
3+
slurp:
4+
src: '{{ config_file.path }}'
5+
register: service_configuration_raw
6+
7+
- name: Parse service's configuration
8+
set_fact:
9+
service_configuration: "{{ service_configuration_raw['content'] | b64decode | from_yaml }}"
10+
service_configuration_text: "{{ service_configuration_raw['content'] | b64decode }}"
11+
12+
- name: Update Oracle Allow List
13+
replace:
14+
path: '{{ config_file.path }}'
15+
regexp: '(?s)ORACLE_ADDRESSES_ALLOWLIST:.*?]["'']{1}'
16+
replace: 'ORACLE_ADDRESSES_ALLOWLIST: ''["0x140Bd8FbDc884f48dA7cb1c09bE8A2fAdfea776E","0xA7410857ABbf75043d61ea54e07D57A6EB6EF186","0x404335BcE530400a5814375E7Ec1FB55fAff3eA2","0x946D3b081ed19173dC83Cd974fC69e1e760B7d78","0x007DE4a5F7bc37E2F26c0cb2E8A95006EE9B89b5","0xe57B3792aDCc5da47EF4fF588883F0ee0c9835C9","0x61c91ECd902EB56e314bB2D5c5C07785444Ea1c8","0x1Ca0fEC59b86F549e1F1184d97cb47794C8Af58d","0xc79F702202E3A6B0B6310B537E786B9ACAA19BAf"]'''
17+
when:
18+
- service_configuration.service == "ValidatorEjectorService"
19+
- service_configuration.network == "mainnet"
20+
- service_configuration.env.ORACLE_ADDRESSES_ALLOWLIST | from_yaml | select('match', '0xEC4BfbAF681eb505B94E4a7849877DC6c600Ca3A') | length == 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
- name: Find service configs
3+
find:
4+
paths: "/etc/stereum/services"
5+
register: service_config_files
6+
7+
- name: Include Prysm Changes
8+
include_tasks: ejector_changes.yaml
9+
loop: "{{ service_config_files.files }}"
10+
loop_control:
11+
loop_var: config_file

‎controls/roles/update-changes/tasks/main.yml

+4
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@
99
- name: Include 2.2.2 Update Scripts
1010
include_tasks: "2.2.2/updates-222.yaml"
1111
ignore_errors: yes
12+
13+
- name: Include 2.2.3 Update Scripts
14+
include_tasks: "2.2.3/updates-223.yaml"
15+
ignore_errors: yes
1216
# EOF

‎launcher/src/backend/HetznerServer.js

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class HetznerServer {
2828
let connected = false;
2929
while (!connected && tries < 300) {
3030
try {
31+
await this.Sleep(2000);
3132
tries++;
3233
log.info(`Trying to connect (${tries})`);
3334
connected = await nodeConnection.sshService.checkSSHConnection(nodeConnection.nodeConnectionParams, 5000);

‎launcher/src/backend/SSHService.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,11 @@ export class SSHService {
188188
this.connectionInfo = null;
189189
}
190190
let counter = 0;
191-
while (this.connectionPool.some((conn) => conn._chanMgr?._count > 0 && counter < 30)) {
191+
while (this.connectionPool.length > 0 && counter < 30) {
192192
this.connectionPool.forEach((conn) => {
193-
if (conn._chanMgr?._count > 0) {
193+
if (conn._chanMgr?._count == 0) {
194194
conn.end();
195+
this.connectionPool = this.connectionPool.filter((c) => c !== conn);
195196
}
196197
});
197198
await new Promise((resolve) => setTimeout(resolve, 1000));

‎launcher/src/backend/ethereum-services/ValidatorEjectorService.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class ValidatorEjectorService extends NodeService {
1818
case "mainnet":
1919
locatorAddress = "0xC1d0b3DE6792Bf6b4b37EccdcC24e45978Cfd2Eb"; //https://docs.lido.fi/deployed-contracts/#core-protocol
2020
oracleAllowList =
21-
'["0x140Bd8FbDc884f48dA7cb1c09bE8A2fAdfea776E","0xA7410857ABbf75043d61ea54e07D57A6EB6EF186","0x404335BcE530400a5814375E7Ec1FB55fAff3eA2","0x946D3b081ed19173dC83Cd974fC69e1e760B7d78","0x007DE4a5F7bc37E2F26c0cb2E8A95006EE9B89b5","0xEC4BfbAF681eb505B94E4a7849877DC6c600Ca3A","0x61c91ECd902EB56e314bB2D5c5C07785444Ea1c8","0x1Ca0fEC59b86F549e1F1184d97cb47794C8Af58d","0xc79F702202E3A6B0B6310B537E786B9ACAA19BAf"]';
21+
'["0x140Bd8FbDc884f48dA7cb1c09bE8A2fAdfea776E","0xA7410857ABbf75043d61ea54e07D57A6EB6EF186","0x404335BcE530400a5814375E7Ec1FB55fAff3eA2","0x946D3b081ed19173dC83Cd974fC69e1e760B7d78","0x007DE4a5F7bc37E2F26c0cb2E8A95006EE9B89b5","0xe57B3792aDCc5da47EF4fF588883F0ee0c9835C9","0x61c91ECd902EB56e314bB2D5c5C07785444Ea1c8","0x1Ca0fEC59b86F549e1F1184d97cb47794C8Af58d","0xc79F702202E3A6B0B6310B537E786B9ACAA19BAf"]';
2222
break;
2323
case "holesky":
2424
locatorAddress = "0x28FAB2059C713A7F9D8c86Db49f9bb0e96Af1ef8"; //https://docs.lido.fi/deployed-contracts/holesky#core-protocol

‎launcher/src/backend/tests/integration/FlashbotsMevBoostService.int.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ test("mevboost installation", async () => {
7373
await testServer.Sleep(30000);
7474
status = await nodeConnection.sshService.exec(`docker logs stereum-${mevboost.id}`);
7575
if (
76-
/listening on 0.0.0.0:18550/.test(status.stdout) &&
76+
/Listening on 0.0.0.0:18550/.test(status.stdout) &&
7777
/using 1 relays/.test(status.stdout) &&
7878
!/Invalid relay URL/.test(status.stdout)
7979
) {
@@ -94,7 +94,7 @@ test("mevboost installation", async () => {
9494
}
9595

9696
// check if Mevboost service is running properly
97-
expect(status.stdout).toMatch(/listening on 0.0.0.0:18550/);
97+
expect(status.stdout).toMatch(/Listening on 0.0.0.0:18550/);
9898
expect(status.stdout).toMatch(/using 1 relays/);
9999
expect(status.stdout).not.toMatch(/Invalid relay URL/);
100100
});

0 commit comments

Comments
 (0)
Please sign in to comment.