From 29a5b69493ca80f5f02dd516b1f28f8f142cd4e4 Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Mon, 6 Jun 2022 15:57:51 +0300 Subject: [PATCH] [MEV Boost\Builder] Add BuilderBid logging --- .../ExecutionLayerManagerImpl.java | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/ethereum/executionlayer/src/main/java/tech/pegasys/teku/ethereum/executionlayer/ExecutionLayerManagerImpl.java b/ethereum/executionlayer/src/main/java/tech/pegasys/teku/ethereum/executionlayer/ExecutionLayerManagerImpl.java index 8f7670345c3..b929dbbc593 100644 --- a/ethereum/executionlayer/src/main/java/tech/pegasys/teku/ethereum/executionlayer/ExecutionLayerManagerImpl.java +++ b/ethereum/executionlayer/src/main/java/tech/pegasys/teku/ethereum/executionlayer/ExecutionLayerManagerImpl.java @@ -51,6 +51,7 @@ import tech.pegasys.teku.spec.Spec; import tech.pegasys.teku.spec.SpecMilestone; import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock; +import tech.pegasys.teku.spec.datastructures.execution.BuilderBid; import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload; import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadContext; import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeader; @@ -319,13 +320,16 @@ public SafeFuture builderGetHeader( .getHeader(slot, validatorPublicKey, executionPayloadContext.getParentHash()) .thenApply(ExecutionLayerManagerImpl::unwrapResponseOrThrow) .thenPeek( - signedBuilderBid -> - LOG.trace( - "builderGetHeader(slot={}, pubKey={}, parentHash={}) -> {}", - slot, - validatorPublicKey, - executionPayloadContext.getParentHash(), - signedBuilderBid)) + signedBuilderBid -> { + LOG.trace( + "builderGetHeader(slot={}, pubKey={}, parentHash={}) -> {}", + slot, + validatorPublicKey, + executionPayloadContext.getParentHash(), + signedBuilderBid); + final BuilderBid builderBid = signedBuilderBid.getMessage(); + logReceivedBuilderBid(builderBid); + }) .thenApplyChecked( signedBuilderBid -> builderBidValidator.validateAndGetPayloadHeader( @@ -440,4 +444,15 @@ private void markBuilderAsNotAvailable(String errorMessage) { latestBuilderAvailability.set(false); eventLogger.executionBuilderIsOffline(errorMessage); } + + private void logReceivedBuilderBid(final BuilderBid builderBid) { + final ExecutionPayloadHeader payloadHeader = builderBid.getExecutionPayloadHeader(); + LOG.info( + "Received Builder Bid (Block Number = {}, Block Hash = {}, MEV Rewards (wei) = {}, Gas Limit = {}, Gas Used = {})", + payloadHeader.getBlockNumber(), + payloadHeader.getBlockHash(), + builderBid.getValue(), + payloadHeader.getGasLimit(), + payloadHeader.getGasUsed()); + } }