Skip to content

Commit

Permalink
Remove --xblock-v3-enabled and useBlindedBlock variable (#8511)
Browse files Browse the repository at this point in the history
* remove experimental flag and useBlindedBlock variable now that V3 can handle blind and unblinded flows.

Signed-off-by: Gabriel Fukushima <[email protected]>

---------

Signed-off-by: Gabriel Fukushima <[email protected]>
  • Loading branch information
gfukushima authored Aug 21, 2024
1 parent c5c85ba commit 3f73ba0
Show file tree
Hide file tree
Showing 34 changed files with 99 additions and 570 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ SafeFuture<BlockContainerAndMetaData> createUnsignedBlock(
UInt64 proposalSlot,
BLSSignature randaoReveal,
Optional<Bytes32> optionalGraffiti,
Optional<Boolean> requestedBlinded,
Optional<UInt64> requestedBuilderBoostFactor,
BlockProductionPerformance blockProductionPerformance);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,13 @@ public SafeFuture<BlockContainerAndMetaData> createUnsignedBlock(
final UInt64 proposalSlot,
final BLSSignature randaoReveal,
final Optional<Bytes32> optionalGraffiti,
final Optional<Boolean> requestedBlinded,
final Optional<UInt64> requestedBuilderBoostFactor,
final BlockProductionPerformance blockProductionPerformance) {
return super.createUnsignedBlock(
blockSlotState,
proposalSlot,
randaoReveal,
optionalGraffiti,
requestedBlinded,
requestedBuilderBoostFactor,
blockProductionPerformance)
.thenCompose(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public SafeFuture<BlockContainerAndMetaData> createUnsignedBlock(
final UInt64 proposalSlot,
final BLSSignature randaoReveal,
final Optional<Bytes32> optionalGraffiti,
final Optional<Boolean> requestedBlinded,
final Optional<UInt64> requestedBuilderBoostFactor,
final BlockProductionPerformance blockProductionPerformance) {
checkArgument(
Expand All @@ -76,7 +75,6 @@ public SafeFuture<BlockContainerAndMetaData> createUnsignedBlock(
blockSlotState,
randaoReveal,
optionalGraffiti,
requestedBlinded,
requestedBuilderBoostFactor,
blockProductionPerformance),
blockProductionPerformance)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ public Function<BeaconBlockBodyBuilder, SafeFuture<Void>> createSelector(
final BeaconState blockSlotState,
final BLSSignature randaoReveal,
final Optional<Bytes32> optionalGraffiti,
final Optional<Boolean> requestedBlinded,
final Optional<UInt64> requestedBuilderBoostFactor,
final BlockProductionPerformance blockProductionPerformance) {

Expand Down Expand Up @@ -190,7 +189,6 @@ public Function<BeaconBlockBodyBuilder, SafeFuture<Void>> createSelector(
setExecutionData(
executionPayloadContext,
bodyBuilder,
requestedBlinded,
requestedBuilderBoostFactor,
SchemaDefinitionsBellatrix.required(schemaDefinitions),
blockSlotState,
Expand All @@ -208,7 +206,6 @@ public Function<BeaconBlockBodyBuilder, SafeFuture<Void>> createSelector(
private SafeFuture<Void> setExecutionData(
final Optional<ExecutionPayloadContext> executionPayloadContext,
final BeaconBlockBodyBuilder bodyBuilder,
final Optional<Boolean> requestedBlinded,
final Optional<UInt64> requestedBuilderBoostFactor,
final SchemaDefinitionsBellatrix schemaDefinitions,
final BeaconState blockSlotState,
Expand All @@ -221,26 +218,18 @@ private SafeFuture<Void> setExecutionData(
blockSlotState.getSlot()));
}

// if requestedBlinded has been specified, we strictly follow it, otherwise we should run
// Builder flow (blinded) only if we have a validator registration
final boolean shouldTryBuilderFlow =
requestedBlinded.orElseGet(
() ->
executionPayloadContext
.map(ExecutionPayloadContext::isValidatorRegistrationPresent)
.orElse(false));

// pre-Merge Execution Payload / Execution Payload Header
if (executionPayloadContext.isEmpty()) {
if (shouldTryBuilderFlow) {
bodyBuilder.executionPayloadHeader(
schemaDefinitions.getExecutionPayloadHeaderSchema().getHeaderOfDefaultPayload());
} else {
bodyBuilder.executionPayload(schemaDefinitions.getExecutionPayloadSchema().getDefault());
}
bodyBuilder.executionPayload(schemaDefinitions.getExecutionPayloadSchema().getDefault());
return SafeFuture.COMPLETE;
}

// We should run Builder flow (blinded) only if we have a validator registration
final boolean shouldTryBuilderFlow =
executionPayloadContext
.map(ExecutionPayloadContext::isValidatorRegistrationPresent)
.orElse(false);

final ExecutionPayloadResult executionPayloadResult =
executionLayerBlockProductionManager.initiateBlockProduction(
executionPayloadContext.orElseThrow(),
Expand All @@ -251,8 +240,7 @@ private SafeFuture<Void> setExecutionData(

return SafeFuture.allOf(
cacheExecutionPayloadValue(executionPayloadResult, blockSlotState),
setPayloadOrPayloadHeader(
bodyBuilder, schemaDefinitions, requestedBlinded, executionPayloadResult),
setPayloadOrPayloadHeader(bodyBuilder, executionPayloadResult),
setKzgCommitments(bodyBuilder, schemaDefinitions, executionPayloadResult));
}

Expand All @@ -268,8 +256,6 @@ private SafeFuture<Void> cacheExecutionPayloadValue(

private SafeFuture<Void> setPayloadOrPayloadHeader(
final BeaconBlockBodyBuilder bodyBuilder,
final SchemaDefinitionsBellatrix schemaDefinitions,
final Optional<Boolean> requestedBlinded,
final ExecutionPayloadResult executionPayloadResult) {

if (executionPayloadResult.isFromLocalFlow()) {
Expand All @@ -287,8 +273,7 @@ private SafeFuture<Void> setPayloadOrPayloadHeader(
builderBidOrFallbackData -> {
// we should try to return unblinded content only if no explicit "blindness" has been
// requested and builder flow fallbacks to local
if (requestedBlinded.isEmpty()
&& builderBidOrFallbackData.getFallbackData().isPresent()) {
if (builderBidOrFallbackData.getFallbackData().isPresent()) {
bodyBuilder.executionPayload(
builderBidOrFallbackData.getFallbackDataRequired().getExecutionPayload());
} else {
Expand All @@ -298,16 +283,7 @@ private SafeFuture<Void> setPayloadOrPayloadHeader(
// from the builder bid
.map(BuilderBid::getHeader)
// from the local fallback
.orElseGet(
() -> {
final ExecutionPayload executionPayload =
builderBidOrFallbackData
.getFallbackDataRequired()
.getExecutionPayload();
return schemaDefinitions
.getExecutionPayloadHeaderSchema()
.createFromExecutionPayload(executionPayload);
});
.orElseThrow();
bodyBuilder.executionPayloadHeader(executionPayloadHeader);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public SafeFuture<BlockContainerAndMetaData> createUnsignedBlock(
final UInt64 proposalSlot,
final BLSSignature randaoReveal,
final Optional<Bytes32> optionalGraffiti,
final Optional<Boolean> requestedBlinded,
final Optional<UInt64> requestedBuilderBoostFactor,
final BlockProductionPerformance blockProductionPerformance) {
final SpecMilestone milestone = getMilestone(proposalSlot);
Expand All @@ -78,7 +77,6 @@ public SafeFuture<BlockContainerAndMetaData> createUnsignedBlock(
proposalSlot,
randaoReveal,
optionalGraffiti,
requestedBlinded,
requestedBuilderBoostFactor,
blockProductionPerformance);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ public SafeFuture<Optional<BlockContainerAndMetaData>> createUnsignedBlock(
final UInt64 slot,
final BLSSignature randaoReveal,
final Optional<Bytes32> graffiti,
final Optional<Boolean> requestedBlinded,
final Optional<UInt64> requestedBuilderBoostFactor) {
LOG.info("Creating unsigned block for slot {}", slot);
performanceTracker.reportBlockProductionAttempt(spec.computeEpochAtSlot(slot));
Expand All @@ -357,7 +356,6 @@ public SafeFuture<Optional<BlockContainerAndMetaData>> createUnsignedBlock(
slot,
randaoReveal,
graffiti,
requestedBlinded,
requestedBuilderBoostFactor,
blockSlotState,
blockProductionPerformance))
Expand All @@ -368,7 +366,6 @@ private SafeFuture<Optional<BlockContainerAndMetaData>> createBlock(
final UInt64 slot,
final BLSSignature randaoReveal,
final Optional<Bytes32> graffiti,
final Optional<Boolean> requestedBlinded,
final Optional<UInt64> requestedBuilderBoostFactor,
final Optional<BeaconState> maybeBlockSlotState,
final BlockProductionPerformance blockProductionPerformance) {
Expand All @@ -390,7 +387,6 @@ private SafeFuture<Optional<BlockContainerAndMetaData>> createBlock(
slot,
randaoReveal,
graffiti,
requestedBlinded,
requestedBuilderBoostFactor,
blockProductionPerformance)
.thenApply(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,17 @@ protected BlockContainerAndMetaData assertBlockCreated(
when(voluntaryExitPool.getItemsForBlock(any(), any(), any())).thenReturn(voluntaryExits);
when(blsToExecutionChangePool.getItemsForBlock(any())).thenReturn(blsToExecutionChanges);
when(eth1DataCache.getEth1Vote(any())).thenReturn(ETH1_DATA);
when(forkChoiceNotifier.getPayloadId(any(), any()))
.thenReturn(
SafeFuture.completedFuture(
Optional.of(dataStructureUtil.randomPayloadExecutionContext(false))));
if (blinded) {
when(forkChoiceNotifier.getPayloadId(any(), any()))
.thenReturn(
SafeFuture.completedFuture(
Optional.of(dataStructureUtil.randomPayloadExecutionContext(false, true))));
} else {
when(forkChoiceNotifier.getPayloadId(any(), any()))
.thenReturn(
SafeFuture.completedFuture(
Optional.of(dataStructureUtil.randomPayloadExecutionContext(false))));
}

final BLSSignature randaoReveal = dataStructureUtil.randomSignature();
final Bytes32 bestBlockRoot = recentChainData.getBestBlockRoot().orElseThrow();
Expand Down Expand Up @@ -237,7 +244,6 @@ protected BlockContainerAndMetaData assertBlockCreated(
newSlot,
randaoReveal,
Optional.empty(),
Optional.of(blinded),
Optional.empty(),
BlockProductionPerformance.NOOP));

Expand Down
Loading

0 comments on commit 3f73ba0

Please sign in to comment.