From ecfe8c46aed11e8299a15efcbb2405969ea19f1b 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 631a3b5632c..f0be29bc0b5 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 @@ -62,7 +62,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);