Skip to content

Commit

Permalink
Update blob sidecar index check
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig committed Dec 19, 2024
1 parent 2c68274 commit c22f78b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/beacon-node/src/chain/validation/blobSidecar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ export async function validateGossipBlobSidecar(
const blobSlot = blobSidecar.signedBlockHeader.message.slot;

// [REJECT] The sidecar's index is consistent with `MAX_BLOBS_PER_BLOCK` -- i.e. `blob_sidecar.index < MAX_BLOBS_PER_BLOCK`.
if (blobSidecar.index >= chain.config.MAX_BLOBS_PER_BLOCK) {
const maxBlobsPerBlock = isForkPostElectra(fork)
? chain.config.MAX_BLOBS_PER_BLOCK_ELECTRA
: chain.config.MAX_BLOBS_PER_BLOCK;
if (blobSidecar.index >= maxBlobsPerBlock) {
throw new BlobSidecarGossipError(GossipAction.REJECT, {
code: BlobSidecarErrorCode.INDEX_TOO_LARGE,
blobIdx: blobSidecar.index,
maxBlobsPerBlock: chain.config.MAX_BLOBS_PER_BLOCK,
maxBlobsPerBlock,
});
}

Expand Down

0 comments on commit c22f78b

Please sign in to comment.