From 61343aeb5cd5b251ff3431d1fa8dde62c277668f Mon Sep 17 00:00:00 2001 From: matthewkeil Date: Thu, 18 Jul 2024 18:10:20 -0300 Subject: [PATCH] feat: narrow type and remove unnecessary conditional --- packages/beacon-node/src/util/blobs.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/beacon-node/src/util/blobs.ts b/packages/beacon-node/src/util/blobs.ts index c9dda47324f..d4f2ed3d59b 100644 --- a/packages/beacon-node/src/util/blobs.ts +++ b/packages/beacon-node/src/util/blobs.ts @@ -7,6 +7,7 @@ import { ForkName, ForkAll, NUMBER_OF_COLUMNS, + ForkBlobs, } from "@lodestar/params"; import {deneb, ssz, BeaconBlockBody, SignedBeaconBlock, SSZTypesFor, peerdas} from "@lodestar/types"; import {ChainForkConfig} from "@lodestar/config"; @@ -72,20 +73,17 @@ export function computeBlobSidecars( */ export function getDataColumnSidecars( config: ChainForkConfig, - signedBlock: SignedBeaconBlock, + signedBlock: SignedBeaconBlock, contents: deneb.Contents & {kzgCommitmentsInclusionProof?: peerdas.KzgCommitmentsInclusionProof} ): peerdas.DataColumnSidecars { const blobKzgCommitments = (signedBlock as deneb.SignedBeaconBlock).message.body.blobKzgCommitments; - const {blobs} = contents; - if (!Array.isArray(blobs)) { - throw Error("Invalid block with missing blobs for computeBlobSidecars"); - } if (blobKzgCommitments === undefined) { throw Error("Invalid block with missing blobKzgCommitments for computeBlobSidecars"); } if (blobKzgCommitments.length === 0) { return []; } + const {blobs} = contents; const fork = config.getForkName(signedBlock.message.slot); const signedBlockHeader = signedBlockToSignedHeader(config, signedBlock); const kzgCommitmentsInclusionProof =