Skip to content

Commit

Permalink
automatically enable blinded-blocks when mev-boost is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
tbenr committed Apr 14, 2022
1 parent 6c816e2 commit bf01053
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,12 @@ public void shouldNotUseBlindedBeaconBlocksByDefault() {
}

@Test
public void shouldEnableMevBoost() {
final String[] args = {
"--Xvalidators-proposer-mev-boost-enabled",
"true",
"--Xvalidators-proposer-blinded-blocks-enabled",
"true"
};
public void shouldEnableMevBoostWithBlindedBlocks() {
final String[] args = {"--Xvalidators-proposer-mev-boost-enabled", "true"};
final TekuConfiguration config = getTekuConfigurationFromArguments(args);
assertThat(config.validatorClient().getValidatorConfig().isProposerMevBoostEnabled()).isTrue();
assertThat(config.validatorClient().getValidatorConfig().isBlindedBeaconBlocksEnabled())
.isTrue();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@
import java.util.List;
import java.util.Optional;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes32;
import tech.pegasys.teku.infrastructure.exceptions.InvalidConfigurationException;
import tech.pegasys.teku.spec.datastructures.eth1.Eth1Address;

public class ValidatorConfig {
private static final Logger LOG = LogManager.getLogger();

private static final int DEFAULT_REST_API_PORT = 5051;
public static final String DEFAULT_BEACON_NODE_API_ENDPOINT =
Expand Down Expand Up @@ -435,9 +438,9 @@ private void validateExternalSignerURLScheme() {

private void validateMevBoostAndBlindedBlocks() {
if (proposerMevBoostEnabled && !blindedBlocksEnabled) {
final String errorMessage =
"Invalid configuration. '--Xvalidators-proposer-mev-boost-enabled' requires '--Xvalidators-proposer-blinded-blocks-enabled' to be enabled as well.";
throw new InvalidConfigurationException(errorMessage);
LOG.info(
"'--Xvalidators-proposer-mev-boost-enabled' requires '--Xvalidators-proposer-blinded-blocks-enabled', enabling it");
blindedBlocksEnabled = true;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

package tech.pegasys.teku.validator.api;

import static org.assertj.core.api.Assertions.assertThatThrownBy;

import java.net.MalformedURLException;
import java.net.URI;
import java.nio.file.Path;
Expand Down Expand Up @@ -167,12 +165,6 @@ public void bellatrix_shouldNotThrowIfValidationIsActiveAndProposerConfigSourceI
verifyProposerConfigOrProposerDefaultFeeRecipientNotThrow(config);
}

@Test
public void shouldThrowIfMevBoostIsWithoutBlindedBeaconBlocks() {
assertThatThrownBy(() -> configBuilder.proposerMevBoostEnabled(true).build())
.isInstanceOf(InvalidConfigurationException.class);
}

void verifyProposerConfigOrProposerDefaultFeeRecipientNotThrow(final ValidatorConfig config) {
Assertions.assertThatCode(config::getProposerDefaultFeeRecipient).doesNotThrowAnyException();
Assertions.assertThatCode(config::getProposerConfigSource).doesNotThrowAnyException();
Expand Down

0 comments on commit bf01053

Please sign in to comment.