Skip to content

Commit

Permalink
ADD: New Oracle Allowlist and Update Script (#1900)
Browse files Browse the repository at this point in the history
* FIX: Tests

* ADD: New Oracle Allowlist and Update Script

* FIX: conditionals and add another case

* FIX: regex

* FIX: Conditionals the 2nd

* FIX: regex the 2nd

* FIX: Quotes

* FIX: regex the 3rd
  • Loading branch information
NeoPlays authored Jun 4, 2024
1 parent 7adb04e commit 2f6bca2
Show file tree
Hide file tree
Showing 12 changed files with 220 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:
{ role: "update-changes", test: "203" },
{ role: "update-changes", test: "213" },
{ role: "update-changes", test: "214" },
{ role: "update-changes", test: "215" },
]
fail-fast: false
concurrency: molecule-test-${{ matrix.tests.role }}-${{ matrix.tests.test }}
Expand Down
10 changes: 10 additions & 0 deletions controls/roles/update-changes/molecule/215/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Converge
hosts: all
vars_files:
- ../../../../defaults/stereum_defaults.yaml

tasks:
- name: "Include update-changes"
include_role:
name: "update-changes"
27 changes: 27 additions & 0 deletions controls/roles/update-changes/molecule/215/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
#dependency:
# name: galaxy
driver:
name: docker
platforms:
- name: "update-changes--2.1.5--ubuntu-23.04"
image: ubuntu:lunar
# - name: "configure-updates--default--centos-8"
# image: geerlingguy/docker-centos8-ansible
provisioner:
name: ansible
env:
ANSIBLE_PIPELINING: "True"
lint: |
set -e
yamllint .
ansible-lint .
scenario:
test_sequence:
- destroy
- create
- prepare
- converge
- idempotence
- verify
- destroy
7 changes: 7 additions & 0 deletions controls/roles/update-changes/molecule/215/playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: Converge
hosts: all
tasks:
- name: "Include update-changes"
include_role:
name: "update-changes"
103 changes: 103 additions & 0 deletions controls/roles/update-changes/molecule/215/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
- name: Prepare
hosts: all
tasks:
- name: Make sure Stereum's config path exists
file:
path: "/etc/stereum/services"
state: directory
owner: "root"
group: "root"
mode: 0644
become: yes

- name: Create ValidatorEjectorService config
copy:
dest: "/etc/stereum/services/f12b9300-d46c-c9cc-99a6-e437aa71ef5b.yaml"
owner: "root"
group: "root"
mode: 0644
content: |
service: ValidatorEjectorService
id: f12b9300-d46c-c9cc-99a6-e437aa71ef5b
configVersion: 1
command: []
entrypoint: []
env:
EXECUTION_NODE: http://stereum-f34a2967-b99d-0edc-cfe9-43e47884fa66:8545
CONSENSUS_NODE: http://stereum-4c23e774-519b-62ca-9ccf-e9b274cfad8c:5052
LOCATOR_ADDRESS: "0x28FAB2059C713A7F9D8c86Db49f9bb0e96Af1ef8"
STAKING_MODULE_ID: "123"
OPERATOR_ID: "123"
MESSAGES_LOCATION: /app/messages
ORACLE_ADDRESSES_ALLOWLIST: '["0x12A1D74F8697b9f4F1eEBb0a9d0FB6a751366399",
"0xD892c09b556b547c80B7d8c8cB8d75bf541B2284",
"0xf7aE520e99ed3C41180B5E12681d31Aa7302E4e5",
"0xD3b1e36A372Ca250eefF61f90E833Ca070559970",
"0xF0F23944EfC5A63c53632C571E7377b85d5E6B6f",
"0xb29dD2f6672C0DFF2d2f173087739A42877A5172",
"0x3799bDA7B884D33F79CEC926af21160dc47fbe05"]'
HTTP_PORT: "8989"
RUN_METRICS: "true"
RUN_HEALTH_CHECK: "true"
DRY_RUN: "false"
image: lidofinance/validator-ejector:1.6.0
ports: []
volumes:
- /opt/stereum/validatorejector-f12b9300-d46c-c9cc-99a6-e437aa71ef5b/messages:/app/messages
user: "2000"
autoupdate: true
network: holesky
dependencies:
executionClients:
- service: GethService
id: f34a2967-b99d-0edc-cfe9-43e47884fa66
consensusClients:
- service: LighthouseBeaconService
id: 4c23e774-519b-62ca-9ccf-e9b274cfad8c
mevboost: []
otherServices: []
become: yes

- name: Create ValidatorEjectorService config
copy:
dest: "/etc/stereum/services/147c5807-b646-471f-aaa4-5e215ad98b75.yaml"
owner: "root"
group: "root"
mode: 0644
content: |
service: ValidatorEjectorService
id: 147c5807-b646-471f-aaa4-5e215ad98b75
configVersion: 1
command: []
entrypoint: []
env:
EXECUTION_NODE: http://stereum-f34a2967-b99d-0edc-cfe9-43e47884fa66:8545
CONSENSUS_NODE: http://stereum-4c23e774-519b-62ca-9ccf-e9b274cfad8c:5052
LOCATOR_ADDRESS: "0x28FAB2059C713A7F9D8c86Db49f9bb0e96Af1ef8"
STAKING_MODULE_ID: "123"
OPERATOR_ID: "123"
MESSAGES_LOCATION: /app/messages
ORACLE_ADDRESSES_ALLOWLIST: '["0x12A1D74F8697b9f4F1eEBb0a9d0FB6a751366399","0xD892c09b556b547c80B7d8c8cB8d75bf541B2284","0xf7aE520e99ed3C41180B5E12681d31Aa7302E4e5","0x31fa51343297FFce0CC1E67a50B2D3428057D1b1","0x81E411f1BFDa43493D7994F82fb61A415F6b8Fd4","0x4c75FA734a39f3a21C57e583c1c29942F021C6B7","0xD3b1e36A372Ca250eefF61f90E833Ca070559970","0xF0F23944EfC5A63c53632C571E7377b85d5E6B6f","0xb29dD2f6672C0DFF2d2f173087739A42877A5172"]'
HTTP_PORT: "8989"
RUN_METRICS: "true"
RUN_HEALTH_CHECK: "true"
DRY_RUN: "false"
image: lidofinance/validator-ejector:1.6.0
ports: []
volumes:
- /opt/stereum/validatorejector-147c5807-b646-471f-aaa4-5e215ad98b75/messages:/app/messages
user: "2000"
autoupdate: true
network: holesky
dependencies:
executionClients:
- service: GethService
id: f34a2967-b99d-0edc-cfe9-43e47884fa66
consensusClients:
- service: LighthouseBeaconService
id: 4c23e774-519b-62ca-9ccf-e9b274cfad8c
mevboost: []
otherServices: []
become: yes
# EOF
37 changes: 37 additions & 0 deletions controls/roles/update-changes/molecule/215/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
# ValidatorEjectorService
- name: Read ValidatorEjectorService file
slurp:
src: "/etc/stereum/services/f12b9300-d46c-c9cc-99a6-e437aa71ef5b.yaml"
register: Ejector_service_configuration_raw

# ValidatorEjectorService2
- name: Read ValidatorEjectorService file
slurp:
src: "/etc/stereum/services/147c5807-b646-471f-aaa4-5e215ad98b75.yaml"
register: Ejector_service_configuration2_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 }}"

- debug:
msg: "{{ Ejector_service_configuration }}"
- debug:
msg: "{{ Ejector_service_configuration_raw['content'] | b64decode }}"

- debug:
msg: "{{ Ejector_service_configuration2 }}"
- debug:
msg: "{{ Ejector_service_configuration2_raw['content'] | b64decode }}"

- assert:
that:
- Ejector_service_configuration.env.ORACLE_ADDRESSES_ALLOWLIST | from_yaml | length == 10
- Ejector_service_configuration2.env.ORACLE_ADDRESSES_ALLOWLIST | from_yaml | length == 9
# EOF
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
- name: Read service file
slurp:
src: "{{ item.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 Oracle Allow List
replace:
path: "{{ item.path }}"
regexp: "(?s)ORACLE_ADDRESSES_ALLOWLIST:.*?][\"']{1}"
replace: "ORACLE_ADDRESSES_ALLOWLIST: '[\"0x12A1D74F8697b9f4F1eEBb0a9d0FB6a751366399\", \"0xD892c09b556b547c80B7d8c8cB8d75bf541B2284\", \"0xf7aE520e99ed3C41180B5E12681d31Aa7302E4e5\", \"0x31fa51343297FFce0CC1E67a50B2D3428057D1b1\", \"0x81E411f1BFDa43493D7994F82fb61A415F6b8Fd4\", \"0x4c75FA734a39f3a21C57e583c1c29942F021C6B7\", \"0xD3b1e36A372Ca250eefF61f90E833Ca070559970\", \"0xF0F23944EfC5A63c53632C571E7377b85d5E6B6f\", \"0xb29dD2f6672C0DFF2d2f173087739A42877A5172\", \"0x3799bDA7B884D33F79CEC926af21160dc47fbe05\"]'"
when:
- service_configuration.service == "ValidatorEjectorService"
- service_configuration.network == "holesky"
- service_configuration.env.ORACLE_ADDRESSES_ALLOWLIST | from_yaml | length < 8
9 changes: 9 additions & 0 deletions controls/roles/update-changes/tasks/2.1.5/updates-215.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Find service configs
find:
paths: "/etc/stereum/services"
register: service_config_files

- name: Include ValidatorEjector Changes
include_tasks: ValidatorEjector_changes.yaml
loop: "{{ service_config_files.files }}"
4 changes: 4 additions & 0 deletions controls/roles/update-changes/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@
- name: Include 2.1.4 Update Scripts
include_tasks: "2.1.4/updates-214.yaml"
ignore_errors: yes

- name: Include 2.1.5 Update Scripts
include_tasks: "2.1.5/updates-215.yaml"
ignore_errors: yes
# EOF
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class ValidatorEjectorService extends NodeService {
break;
case "holesky":
locatorAddress = "0x28FAB2059C713A7F9D8c86Db49f9bb0e96Af1ef8" //https://docs.lido.fi/deployed-contracts/holesky#core-protocol
oracleAllowList = '["0x12A1D74F8697b9f4F1eEBb0a9d0FB6a751366399","0xD892c09b556b547c80B7d8c8cB8d75bf541B2284","0xf7aE520e99ed3C41180B5E12681d31Aa7302E4e5","0x31fa51343297FFce0CC1E67a50B2D3428057D1b1","0x81E411f1BFDa43493D7994F82fb61A415F6b8Fd4","0x4c75FA734a39f3a21C57e583c1c29942F021C6B7","0xD3b1e36A372Ca250eefF61f90E833Ca070559970"]'
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ test("lighthouse validator import", async () => {
await serviceManager.manageServiceState(lhVC.id, "started");

//Waiting for the service to start properly
await testServer.Sleep(60000);
await testServer.Sleep(360000);

//import validator
const validatorAccountManager = new ValidatorAccountManager(nodeConnection, serviceManager);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ test("nimbus validator import", async () => {
/Listening to incoming network requests/.test(BCstatus.stdout) &&
/REST service started/.test(BCstatus.stdout) &&
/Slot start/.test(BCstatus.stdout) &&
/Failed to obtain the most recent known block from the execution layer node \(the node is probably not synced\)/.test(BCstatus.stdout) &&
/Beacon node is online/.test(VCstatus.stdout) &&
/Beacon node is compatible/.test(VCstatus.stdout) &&
/Local validator attached/.test(VCstatus.stdout) &&
Expand Down Expand Up @@ -141,7 +140,6 @@ test("nimbus validator import", async () => {
}

//check nimbus service logs
expect(BCstatus.stdout).toMatch(/Failed to obtain the most recent known block from the execution layer node \(the node is probably not synced\)/);
expect(BCstatus.stdout).toMatch(/Starting beacon node/);
expect(BCstatus.stdout).toMatch(/Listening to incoming network requests/);
expect(BCstatus.stdout).toMatch(/REST service started/);
Expand Down

0 comments on commit 2f6bca2

Please sign in to comment.