Skip to content

Commit

Permalink
use bounded blob sidecar index
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBratanov committed Nov 17, 2023
1 parent 7bdab36 commit ecfe8c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public SafeFuture<SendSignedBlockResult> sendSignedBlock(
.thenCompose(
signedBlock -> {
// creating blob sidecars after unblinding the block to ensure in the blinded flow we
// already have cached the builder payload
// will have the cached builder payload
final List<BlobSidecar> blobSidecars =
blockFactory.createBlobSidecars(blockContainer);
return gossipAndImportUnblindedSignedBlockAndBlobSidecars(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2561,7 +2561,7 @@ public BlobSidecar build() {
.getBlobSidecarSchema();

return blobSidecarSchema.create(
index.orElse(randomUInt64()),
index.orElse(randomBlobSidecarIndex()),
blob.orElse(randomBytes(blobSidecarSchema.getBlobSchema().getLength())),
kzgCommitment.orElse(randomBytes48()),
kzgProof.orElse(randomBytes48()),
Expand Down Expand Up @@ -2612,6 +2612,10 @@ public RewardAndPenaltyDeltas randomRewardAndPenaltyDeltas(final int validatorCo
return rewardAndPenaltyDeltas;
}

private UInt64 randomBlobSidecarIndex() {
return randomUInt64(spec.getMaxBlobsPerBlock().orElseThrow());
}

private int randomNumberOfBlobsPerBlock() {
// minimum 1 blob
return randomInt(1, spec.getMaxBlobsPerBlock().orElseThrow() + 1);
Expand Down

0 comments on commit ecfe8c4

Please sign in to comment.