Skip to content

Commit

Permalink
ADD: New Oracle Changes and activate CSM Mainnet (#2100)
Browse files Browse the repository at this point in the history
* ADD: New Oracle Changes

* ADD: Mainnet Contract Addresses for csm monitor service

* ADD: CSM

* FIX: handle case when service is not in updates.json

---------

Co-authored-by: Martin Wostal <[email protected]>
  • Loading branch information
NeoPlays and M4r71nW authored Nov 20, 2024
1 parent 1d0de7a commit 0a0555e
Show file tree
Hide file tree
Showing 14 changed files with 246 additions and 18 deletions.
10 changes: 10 additions & 0 deletions controls/roles/update-changes/molecule/224/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/224/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.2.4--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/224/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"
105 changes: 105 additions & 0 deletions controls/roles/update-changes/molecule/224/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
- 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/15ce3684-4dbd-4657-8a21-b1243b72b1ca.yaml"
owner: "root"
group: "root"
mode: 0644
content: |
service: ValidatorEjectorService
id: 15ce3684-4dbd-4657-8a21-b1243b72b1ca
configVersion: 1
command: []
entrypoint: []
env:
EXECUTION_NODE: http://stereum-ce456ae0-64d6-4886-a53b-6b90984d4913:8545
CONSENSUS_NODE: http://stereum-e7bd77d1-4d20-4a2e-85a6-1915f105a4c6:5052
LOCATOR_ADDRESS: "0x28FAB2059C713A7F9D8c86Db49f9bb0e96Af1ef8"
STAKING_MODULE_ID: "123"
OPERATOR_ID: "123"
MESSAGES_LOCATION: /app/messages
ORACLE_ADDRESSES_ALLOWLIST: '["0x140Bd8FbDc884f48dA7cb1c09bE8A2fAdfea776E",
"0xA7410857ABbf75043d61ea54e07D57A6EB6EF186",
"0x404335BcE530400a5814375E7Ec1FB55fAff3eA2",
"0x946D3b081ed19173dC83Cd974fC69e1e760B7d78",
"0x007DE4a5F7bc37E2F26c0cb2E8A95006EE9B89b5",
"0xe57B3792aDCc5da47EF4fF588883F0ee0c9835C9",
"0x61c91ECd902EB56e314bB2D5c5C07785444Ea1c8",
"0x1Ca0fEC59b86F549e1F1184d97cb47794C8Af58d",
"0xc79F702202E3A6B0B6310B537E786B9ACAA19BAf"]'
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-15ce3684-4dbd-4657-8a21-b1243b72b1ca/messages:/app/messages
user: "2000"
autoupdate: true
network: mainnet
dependencies:
executionClients:
- service: GethService
id: ce456ae0-64d6-4886-a53b-6b90984d4913
consensusClients:
- service: LighthouseBeaconService
id: e7bd77d1-4d20-4a2e-85a6-1915f105a4c6
mevboost: []
otherServices: []
become: yes

- name: Create ValidatorEjectorService config
copy:
dest: "/etc/stereum/services/41b15ea7-12d4-49f6-8448-8a6164edef36.yaml"
owner: "root"
group: "root"
mode: 0644
content: |
service: ValidatorEjectorService
id: 41b15ea7-12d4-49f6-8448-8a6164edef36
configVersion: 1
command: []
entrypoint: []
env:
EXECUTION_NODE: http://stereum-cc1323ce-90a1-440f-8b78-f930a3300b38:8545
CONSENSUS_NODE: http://stereum-62cb879b-b0f0-4ea2-bc13-f606b7f4cfb9:5052
LOCATOR_ADDRESS: "0x28FAB2059C713A7F9D8c86Db49f9bb0e96Af1ef8"
STAKING_MODULE_ID: "123"
OPERATOR_ID: "123"
MESSAGES_LOCATION: /app/messages
ORACLE_ADDRESSES_ALLOWLIST: '["0x140Bd8FbDc884f48dA7cb1c09bE8A2fAdfea776E","0xA7410857ABbf75043d61ea54e07D57A6EB6EF186","0x404335BcE530400a5814375E7Ec1FB55fAff3eA2","0x946D3b081ed19173dC83Cd974fC69e1e760B7d78","0x007DE4a5F7bc37E2F26c0cb2E8A95006EE9B89b5","0xe57B3792aDCc5da47EF4fF588883F0ee0c9835C9","0x61c91ECd902EB56e314bB2D5c5C07785444Ea1c8","0x1Ca0fEC59b86F549e1F1184d97cb47794C8Af58d","0xc79F702202E3A6B0B6310B537E786B9ACAA19BAf"]'
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-41b15ea7-12d4-49f6-8448-8a6164edef36/messages:/app/messages
user: "2000"
autoupdate: true
network: mainnet
dependencies:
executionClients:
- service: GethService
id: cc1323ce-90a1-440f-8b78-f930a3300b38
consensusClients:
- service: LighthouseBeaconService
id: 62cb879b-b0f0-4ea2-bc13-f606b7f4cfb9
mevboost: []
otherServices: []
become: yes
#EOF
39 changes: 39 additions & 0 deletions controls/roles/update-changes/molecule/224/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
# ValidatorEjectorService
- name: Read ValidatorEjectorService file
slurp:
src: "/etc/stereum/services/15ce3684-4dbd-4657-8a21-b1243b72b1ca.yaml"
register: Ejector_service_configuration_raw

# ValidatorEjectorService2
- name: Read ValidatorEjectorService file
slurp:
src: "/etc/stereum/services/41b15ea7-12d4-49f6-8448-8a6164edef36.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 | 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
# EOF
20 changes: 20 additions & 0 deletions controls/roles/update-changes/tasks/2.2.4/ejector_changes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
- 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 Oracle Allow List
replace:
path: "{{ config_file.path }}"
regexp: '(?s)ORACLE_ADDRESSES_ALLOWLIST:.*?]["'']{1}'
replace: 'ORACLE_ADDRESSES_ALLOWLIST: ''["0x140Bd8FbDc884f48dA7cb1c09bE8A2fAdfea776E","0xA7410857ABbf75043d61ea54e07D57A6EB6EF186","0x404335BcE530400a5814375E7Ec1FB55fAff3eA2","0x946D3b081ed19173dC83Cd974fC69e1e760B7d78","0x007DE4a5F7bc37E2F26c0cb2E8A95006EE9B89b5","0xe57B3792aDCc5da47EF4fF588883F0ee0c9835C9","0x61c91ECd902EB56e314bB2D5c5C07785444Ea1c8","0x73181107c8D9ED4ce0bbeF7A0b4ccf3320C41d12","0xc79F702202E3A6B0B6310B537E786B9ACAA19BAf"]'''
when:
- service_configuration.service == "ValidatorEjectorService"
- service_configuration.network == "mainnet"
- service_configuration.env.ORACLE_ADDRESSES_ALLOWLIST | from_yaml | select('match', '0x1Ca0fEC59b86F549e1F1184d97cb47794C8Af58d') | length == 1
11 changes: 11 additions & 0 deletions controls/roles/update-changes/tasks/2.2.4/updates-224.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Find service configs
find:
paths: "/etc/stereum/services"
register: service_config_files

- name: Include Ejector Changes
include_tasks: ejector_changes.yaml
loop: "{{ service_config_files.files }}"
loop_control:
loop_var: config_file
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 @@ -13,4 +13,8 @@
- name: Include 2.2.3 Update Scripts
include_tasks: "2.2.3/updates-223.yaml"
ignore_errors: yes

- name: Include 2.2.4 Update Scripts
include_tasks: "2.2.4/updates-224.yaml"
ignore_errors: yes
# EOF
7 changes: 3 additions & 4 deletions controls/roles/update-services/tasks/update-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

- name: Get latest version for this service
set_fact:
new_service_docker_image_tag: "{{ update_data.json[service_configuration.network][service_configuration.service] | default(update_data.json['mainnet'][service_configuration.service]) | last }}"
new_service_docker_image_tag: "{{ (update_data.json[service_configuration.network][service_configuration.service] | default(update_data.json['mainnet'][service_configuration.service] | default([]))) | last }}"
when: service_configuration.autoupdate and service_configuration.service != 'CustomService'

- name: Build new image tag
set_fact:
new_service_configuration_fraction:
image: "{{ service_docker_image }}:{{ new_service_docker_image_tag }}"
image: "{{ service_docker_image }}:{{ new_service_docker_image_tag | default(service_docker_image_tag) }}"
when: service_configuration.autoupdate

- name: Update configuration
Expand All @@ -33,12 +33,11 @@

- name: Write configuration
copy:
content: '{{ new_service_configuration | to_nice_yaml }}'
content: "{{ new_service_configuration | to_nice_yaml }}"
dest: "/etc/stereum/services/{{ item }}.yaml"
owner: "root"
group: "root"
mode: 0644
when: service_configuration.autoupdate and new_service_docker_image_tag != service_docker_image_tag
become: yes

# EOF
2 changes: 2 additions & 0 deletions launcher/src/backend/Monitoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -1746,6 +1746,7 @@ export class Monitoring {

// Get attestation rewards for given validators and epoch
async getAttestationRewards(validators) {
if (validators.length === 0) return [];
try {
// Get local beacon port from first available consensus client
const beaconResult = await this.findBeaconPort();
Expand Down Expand Up @@ -1808,6 +1809,7 @@ export class Monitoring {

// Get Sync Committee for given validators and slot (count them together for whole epoch in frontend)
async getSyncCommitteeRewards(validators, slot) {
if (validators.length === 0) return [];
try {
// Get local beacon port from first available consensus client
const beaconResult = await this.findBeaconPort();
Expand Down
3 changes: 3 additions & 0 deletions launcher/src/backend/ethereum-services/LCOMService.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export class LCOMService extends NodeService {

// Mainnet smart-contract addresses:
MAINNET_VALIDATORSEXITBUSORACLE_ADDRESS: "0x0De4Ea0184c2ad0BacA7183356Aea5B8d5Bf5c6e",
MAINNET_CSMODULE_ADDRESS: "0xdA7dE2ECdDfccC6c3AF10108Db212ACBBf9EA83F",
MAINNET_CSACCOUNTING_ADDRESS: "0x4d72BFF1BeaC69925F8Bd12526a39BAAb069e5Da",
MAINNET_CSFEEDISTRIBUTOR_ADDRESS: "0xD99CC66fEC647E68294C6477B40fC7E0F6F618D0",

// Holesky Testnet smart-contract addresses:
HOLESKY_VALIDATORSEXITBUSORACLE_ADDRESS: "0xffDDF7025410412deaa05E3E1cE68FE53208afcb",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class ValidatorEjectorService extends NodeService {
case "mainnet":
locatorAddress = "0xC1d0b3DE6792Bf6b4b37EccdcC24e45978Cfd2Eb"; //https://docs.lido.fi/deployed-contracts/#core-protocol
oracleAllowList =
'["0x140Bd8FbDc884f48dA7cb1c09bE8A2fAdfea776E","0xA7410857ABbf75043d61ea54e07D57A6EB6EF186","0x404335BcE530400a5814375E7Ec1FB55fAff3eA2","0x946D3b081ed19173dC83Cd974fC69e1e760B7d78","0x007DE4a5F7bc37E2F26c0cb2E8A95006EE9B89b5","0xe57B3792aDCc5da47EF4fF588883F0ee0c9835C9","0x61c91ECd902EB56e314bB2D5c5C07785444Ea1c8","0x1Ca0fEC59b86F549e1F1184d97cb47794C8Af58d","0xc79F702202E3A6B0B6310B537E786B9ACAA19BAf"]';
'["0x140Bd8FbDc884f48dA7cb1c09bE8A2fAdfea776E","0xA7410857ABbf75043d61ea54e07D57A6EB6EF186","0x404335BcE530400a5814375E7Ec1FB55fAff3eA2","0x946D3b081ed19173dC83Cd974fC69e1e760B7d78","0x007DE4a5F7bc37E2F26c0cb2E8A95006EE9B89b5","0xe57B3792aDCc5da47EF4fF588883F0ee0c9835C9","0x61c91ECd902EB56e314bB2D5c5C07785444Ea1c8","0x73181107c8D9ED4ce0bbeF7A0b4ccf3320C41d12","0xc79F702202E3A6B0B6310B537E786B9ACAA19BAf"]';
break;
case "holesky":
locatorAddress = "0x28FAB2059C713A7F9D8c86Db49f9bb0e96Af1ef8"; //https://docs.lido.fi/deployed-contracts/holesky#core-protocol
Expand Down
25 changes: 13 additions & 12 deletions launcher/src/composables/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export async function useListKeys(forceRefresh) {
if ((client.config.keys === undefined || client.config.keys.length === 0 || forceRefresh) && client.state === "running") {
//refresh validaotr list
let result = await ControlService.listValidators(client.config.serviceID);

if (!client.service.includes("Web3Signer")) {
let resultRemote = await ControlService.listRemoteKeys(client.config.serviceID);
let remoteKeys = resultRemote.data
Expand Down Expand Up @@ -102,6 +101,7 @@ export async function useListKeys(forceRefresh) {
}

export async function useUpdateValidatorStats() {
console.log("test");
const nodeManageStore = useNodeManage();
const stakingStore = useStakingStore();
let totalBalance = 0;
Expand All @@ -119,18 +119,19 @@ export async function useUpdateValidatorStats() {
});
var latestEpoch = latestEpochResponse.data.data.epoch;
let buffer = stakingStore.keys.map((key) => key.key);
if (stakingStore.keys.length <= 100) {
const chunkSize = 50;
for (let i = 0; i < buffer.length; i += chunkSize) {
//split validator accounts into chunks of 50 (api url limit)
const chunk = buffer.slice(i, i + chunkSize);
let response = await axios.get(nodeManageStore.currentNetwork.dataEndpoint + "/validator/" + encodeURIComponent(chunk.join()), {
validateStatus: function (status) {
return status < 500;
},
});

const chunkSize = 50;
for (let i = 0; i < buffer.length; i += chunkSize) {
//split validator accounts into chunks of 50 (api url limit)
const chunk = buffer.slice(i, i + chunkSize);
let response = await axios.get(nodeManageStore.currentNetwork.dataEndpoint + "/validator/" + encodeURIComponent(chunk.join()), {
validateStatus: function (status) {
return status < 500;
},
});

if (response.data.data) data = data.concat(response.data.data); //merge all gathered stats in one array
if (response.data.data) data = data.concat(response.data.data); //merge all gathered stats in one array
}
}
}
} catch (err) {
Expand Down
2 changes: 1 addition & 1 deletion launcher/src/store/nodeManage.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export const useNodeManage = defineStore("nodeManage", {
icon: "/img/icon/network-icons/ethereum-mainnet.png",
currencyIcon: "/img/icon/control-page-icons/mainnet-currency-symbol.png",
dataEndpoint: "https://mainnet.beaconcha.in/api/v1",
support: ["staking", "mev boost", "stereum on arm", "ssv.network", "obol", "archive", "lidoobol", "lidossv"],
support: ["staking", "mev boost", "stereum on arm", "ssv.network", "obol", "archive", "lidoobol", "lidossv", "lidocsm"],
},

{
Expand Down

0 comments on commit 0a0555e

Please sign in to comment.