Skip to content

Commit

Permalink
ADD: CSM
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoPlays committed Oct 29, 2024
1 parent 9b91c1c commit 861fbcc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
2 changes: 2 additions & 0 deletions launcher/src/backend/Monitoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -1739,6 +1739,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 @@ -1801,6 +1802,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
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 861fbcc

Please sign in to comment.