From aad6a7fa349841f8dd8012934bd192a937314c67 Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Fri, 17 Nov 2023 08:48:15 +0000 Subject: [PATCH] use bounded blob sidecar index --- .../coordinator/publisher/AbstractBlockPublisher.java | 2 +- .../java/tech/pegasys/teku/spec/util/DataStructureUtil.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/beacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/publisher/AbstractBlockPublisher.java b/beacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/publisher/AbstractBlockPublisher.java index 922bb8f7efd..a64f7e262e9 100644 --- a/beacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/publisher/AbstractBlockPublisher.java +++ b/beacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/publisher/AbstractBlockPublisher.java @@ -61,7 +61,7 @@ public SafeFuture 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 blobSidecars = blockFactory.createBlobSidecars(blockContainer); return gossipAndImportUnblindedSignedBlockAndBlobSidecars( diff --git a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/util/DataStructureUtil.java b/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/util/DataStructureUtil.java index 71dbef4bbcf..d7a49cb3dbc 100644 --- a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/util/DataStructureUtil.java +++ b/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/util/DataStructureUtil.java @@ -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()), @@ -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);