From 6f237034315efb4aa25f97bbde40d33986ace396 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Thu, 10 Oct 2024 14:44:32 +0100 Subject: [PATCH] Clarify not yet initialized error for prev proposer duties --- packages/beacon-node/src/api/impl/validator/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/beacon-node/src/api/impl/validator/index.ts b/packages/beacon-node/src/api/impl/validator/index.ts index 8855048d86a..43bb6018746 100644 --- a/packages/beacon-node/src/api/impl/validator/index.ts +++ b/packages/beacon-node/src/api/impl/validator/index.ts @@ -973,7 +973,9 @@ export function getValidatorApi( case stateEpoch - 1: { const indexesPrevEpoch = state.epochCtx.getBeaconProposersPrevEpoch(); if (indexesPrevEpoch === null) { - throw new ApiError(500, `Proposer duties for previous epoch ${epoch} not yet initialized`); + // Should not happen as previous proposer duties should be initialized for head state + // and if we load state from `Uint8Array` it will always be the state of requested epoch + throw Error(`Proposer duties for previous epoch ${epoch} not yet initialized`); } indexes = indexesPrevEpoch; break;