Skip to content

Commit

Permalink
feat: narrow type and remove unnecessary conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewkeil committed Sep 9, 2024
1 parent 1f88c54 commit 61343ae
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/beacon-node/src/util/blobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -72,20 +73,17 @@ export function computeBlobSidecars(
*/
export function getDataColumnSidecars(
config: ChainForkConfig,
signedBlock: SignedBeaconBlock,
signedBlock: SignedBeaconBlock<ForkBlobs>,
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 =
Expand Down

0 comments on commit 61343ae

Please sign in to comment.