diff --git a/packages/validator/src/services/prepareBeaconProposer.ts b/packages/validator/src/services/prepareBeaconProposer.ts index 65c34e478efd..f7662c17b56e 100644 --- a/packages/validator/src/services/prepareBeaconProposer.ts +++ b/packages/validator/src/services/prepareBeaconProposer.ts @@ -86,7 +86,9 @@ export function pollBuilderValidatorRegistration( const pubkeyHexes = validatorStore .getAllLocalIndices() .map((index) => validatorStore.getPubkeyOfIndex(index)) - .filter((pubkeyHex) => pubkeyHex !== undefined && validatorStore.isBuilderEnabled(pubkeyHex)); + .filter( + (pubkeyHex): pubkeyHex is string => pubkeyHex !== undefined && validatorStore.isBuilderEnabled(pubkeyHex) + ); if (pubkeyHexes.length > 0) { const pubkeyHexesChunks = batchItems(pubkeyHexes, {batchSize: REGISTRATION_CHUNK_SIZE}); @@ -95,11 +97,6 @@ export function pollBuilderValidatorRegistration( try { const registrations = await Promise.all( pubkeyHexes.map((pubkeyHex): Promise => { - // Just to make typescript happy as it can't figure out we have filtered - // undefined pubkeys above - if (pubkeyHex === undefined) { - throw Error("All undefined pubkeys should have been filtered out"); - } const feeRecipient = validatorStore.getFeeRecipient(pubkeyHex); const gasLimit = validatorStore.getGasLimit(pubkeyHex); return validatorStore.getValidatorRegistration(pubkeyHex, {feeRecipient, gasLimit}, slot);