Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show debug message if fee recipient from builder differs from registration #6024

Merged
merged 5 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,22 @@
package tech.pegasys.teku.ethereum.executionlayer;

import java.util.Optional;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes;
import tech.pegasys.teku.bls.BLS;
import tech.pegasys.teku.infrastructure.logging.EventLogger;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.Spec;
import tech.pegasys.teku.spec.datastructures.eth1.Eth1Address;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeader;
import tech.pegasys.teku.spec.datastructures.execution.SignedBuilderBid;
import tech.pegasys.teku.spec.datastructures.execution.SignedValidatorRegistration;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState;
import tech.pegasys.teku.spec.logic.common.statetransition.exceptions.BlockProcessingException;

public class BuilderBidValidatorImpl implements BuilderBidValidator {
private static final Logger LOG = LogManager.getLogger();
private final EventLogger eventLogger;

public BuilderBidValidatorImpl(final EventLogger eventLogger) {
Expand Down Expand Up @@ -87,6 +91,24 @@ public ExecutionPayloadHeader validateAndGetPayloadHeader(

eventLogger.builderBidNotHonouringGasLimit(parentGasLimit, proposedGasLimit, preferredGasLimit);

// Show a debug message if the fee recipient in the builder bid differs from the fee recipient
// specified in the validator registration. This is expected behavior and is not a clear sign of
// a dishonest builder. They can build a block in advance of knowing who the fee recipient is
// (giving them more time) using their own fee recipient, then just insert one last transaction
// into the block to transfer the payment to the requested fee recipient. It probably indicates
// a smart builder optimizing things well.
final Eth1Address suggestedFeeRecipient =
signedValidatorRegistration.getMessage().getFeeRecipient();
if (!executionPayloadHeader.getFeeRecipient().equals(suggestedFeeRecipient)) {
final Eth1Address payloadHeaderFeeRecipient =
Eth1Address.fromBytes(executionPayloadHeader.getFeeRecipient().getWrappedBytes());
LOG.debug(
"builderBid.feeRecipient ({}) != registration.feeRecipient ({})."
+ " This is expected behavior. Most likely a builder optimization.",
payloadHeaderFeeRecipient,
suggestedFeeRecipient);
}

return executionPayloadHeader;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void validateExecutionPayload(
if (!beaconStateAccessors
.getRandaoMix(state, beaconStateAccessors.getCurrentEpoch(state))
.equals(executionPayloadHeader.getPrevRandao())) {
throw new BlockProcessingException("Execution payload random does not match state randao");
throw new BlockProcessingException("Execution payload randao does not match state randao");
}

if (!miscHelpersBellatrix
Expand Down