From 0d87c28aedb2e0556b027fc0714349542ff17542 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Thu, 10 Oct 2024 19:39:30 +0100 Subject: [PATCH] chore: remove 'active' from validator status type (#7146) * chore: remove 'active' from validator status type * Clean up usage --- packages/beacon-node/src/api/impl/validator/index.ts | 1 - packages/types/src/utils/validatorStatus.ts | 4 +++- packages/validator/src/services/indices.ts | 1 - .../validator/test/unit/services/attestationDuties.test.ts | 2 +- .../validator/test/unit/services/syncCommitteDuties.test.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/beacon-node/src/api/impl/validator/index.ts b/packages/beacon-node/src/api/impl/validator/index.ts index f6cbc4e98e98..8629bbb1f47c 100644 --- a/packages/beacon-node/src/api/impl/validator/index.ts +++ b/packages/beacon-node/src/api/impl/validator/index.ts @@ -1363,7 +1363,6 @@ export function getValidatorApi( const validator = headState.validators.getReadonly(validatorIndex); const status = getValidatorStatus(validator, currentEpoch); return ( - status === "active" || status === "active_exiting" || status === "active_ongoing" || status === "active_slashed" || diff --git a/packages/types/src/utils/validatorStatus.ts b/packages/types/src/utils/validatorStatus.ts index e14a4b14c412..aa8171fbbbd2 100644 --- a/packages/types/src/utils/validatorStatus.ts +++ b/packages/types/src/utils/validatorStatus.ts @@ -1,8 +1,10 @@ import {FAR_FUTURE_EPOCH} from "@lodestar/params"; import {Epoch, phase0} from "../types.js"; +/** + * [Validator status specification](https://hackmd.io/ofFJ5gOmQpu1jjHilHbdQQ) + */ export type ValidatorStatus = - | "active" | "pending_initialized" | "pending_queued" | "active_ongoing" diff --git a/packages/validator/src/services/indices.ts b/packages/validator/src/services/indices.ts index c3f511669bf1..ff8d1d46ab26 100644 --- a/packages/validator/src/services/indices.ts +++ b/packages/validator/src/services/indices.ts @@ -20,7 +20,6 @@ type SimpleValidatorStatus = "pending" | "active" | "exited" | "withdrawn"; const statusToSimpleStatusMapping = (status: routes.beacon.ValidatorStatus): SimpleValidatorStatus => { switch (status) { - case "active": case "active_exiting": case "active_slashed": case "active_ongoing": diff --git a/packages/validator/test/unit/services/attestationDuties.test.ts b/packages/validator/test/unit/services/attestationDuties.test.ts index a9d50eaf42c6..f59b00d88c9c 100644 --- a/packages/validator/test/unit/services/attestationDuties.test.ts +++ b/packages/validator/test/unit/services/attestationDuties.test.ts @@ -33,7 +33,7 @@ describe("AttestationDutiesService", function () { const defaultValidator: routes.beacon.ValidatorResponse = { index, balance: 32e9, - status: "active", + status: "active_ongoing", validator: ssz.phase0.Validator.defaultValue(), }; diff --git a/packages/validator/test/unit/services/syncCommitteDuties.test.ts b/packages/validator/test/unit/services/syncCommitteDuties.test.ts index 87d052b14ae5..d94926e9b564 100644 --- a/packages/validator/test/unit/services/syncCommitteDuties.test.ts +++ b/packages/validator/test/unit/services/syncCommitteDuties.test.ts @@ -36,7 +36,7 @@ describe("SyncCommitteeDutiesService", function () { const defaultValidator: routes.beacon.ValidatorResponse = { index: indices[0], balance: 32e9, - status: "active", + status: "active_ongoing", validator: ssz.phase0.Validator.defaultValue(), };