diff --git a/CHANGELOG.md b/CHANGELOG.md index 2336b19c42c..558c9fa0ee2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ For information on changes in released versions of Teku, see the [releases page] - Ensured dependencies are up to date - Validator Registration signature integration with external signer - Teku-specific Beacon Node API on `/teku/v1/beacon/deposit_snapshot` providing finalized Deposit Tree Snapshot according to the draft EIP-4881 + - Added support for Builder API ### Bug Fixes - Fix not rendering emoticons correctly in graffiti when running in a Docker container diff --git a/teku/src/main/java/tech/pegasys/teku/cli/options/ExecutionLayerOptions.java b/teku/src/main/java/tech/pegasys/teku/cli/options/ExecutionLayerOptions.java index af45ce0b790..47706743bf0 100644 --- a/teku/src/main/java/tech/pegasys/teku/cli/options/ExecutionLayerOptions.java +++ b/teku/src/main/java/tech/pegasys/teku/cli/options/ExecutionLayerOptions.java @@ -48,11 +48,10 @@ public class ExecutionLayerOptions { private String engineJwtSecretFile = null; @Option( - names = {"--Xeb-endpoint"}, + names = {"--builder-endpoint"}, paramLabel = "", - description = "URL for Execution Builder node.", - arity = "1", - hidden = true) + description = "URL for an external Builder node (optional).", + arity = "1") private String executionBuilderEndpoint = null; public void configure(final Builder builder) { diff --git a/teku/src/main/java/tech/pegasys/teku/cli/options/ValidatorProposerOptions.java b/teku/src/main/java/tech/pegasys/teku/cli/options/ValidatorProposerOptions.java index e08c746a7be..3a38a0b79f3 100644 --- a/teku/src/main/java/tech/pegasys/teku/cli/options/ValidatorProposerOptions.java +++ b/teku/src/main/java/tech/pegasys/teku/cli/options/ValidatorProposerOptions.java @@ -50,55 +50,53 @@ public class ValidatorProposerOptions { ValidatorConfig.DEFAULT_VALIDATOR_PROPOSER_CONFIG_REFRESH_ENABLED; @Option( - names = {"--Xvalidators-registration-default-enabled"}, + names = {"--validators-builder-registration-default-enabled"}, paramLabel = "", showDefaultValue = Visibility.ALWAYS, description = "Enable validators registration to builder infrastructure.", arity = "0..1", - fallbackValue = "true", - hidden = true) - private boolean validatorsRegistrationDefaultEnabled = - ValidatorConfig.DEFAULT_VALIDATOR_REGISTRATION_DEFAULT_ENABLED; + fallbackValue = "true") + private boolean builderRegistrationDefaultEnabled = + ValidatorConfig.DEFAULT_BUILDER_REGISTRATION_DEFAULT_ENABLED; @Option( - names = {"--Xvalidators-registration-default-gas-limit"}, + names = {"--Xvalidators-builder-registration-default-gas-limit"}, paramLabel = "", showDefaultValue = Visibility.ALWAYS, description = "Change the default gas limit used for the validators registration.", arity = "1", hidden = true, converter = UInt64Converter.class) - private UInt64 registrationDefaultGasLimit = - ValidatorConfig.DEFAULT_VALIDATOR_REGISTRATION_GAS_LIMIT; + private UInt64 builderRegistrationDefaultGasLimit = + ValidatorConfig.DEFAULT_BUILDER_REGISTRATION_GAS_LIMIT; @Option( - names = {"--Xvalidators-registration-sending-batch-size"}, + names = {"--Xvalidators-builder-registration-sending-batch-size"}, paramLabel = "", showDefaultValue = Visibility.ALWAYS, description = "Change the default batch size for sending validator registrations to the Beacon Node.", arity = "1", hidden = true) - private int registrationSendingBatchSize = + private int builderRegistrationSendingBatchSize = ValidatorConfig.DEFAULT_VALIDATOR_REGISTRATION_SENDING_BATCH_SIZE; @Option( - names = {"--Xvalidators-registration-timestamp-override"}, + names = {"--validators-builder-registration-timestamp-override"}, paramLabel = "", showDefaultValue = Visibility.ALWAYS, description = "Set a constant timestamp in Unix format to be used in validator registrations against builder infrastructure.", arity = "1", hidden = true) - private UInt64 validatorsRegistrationTimestampOverride = null; + private UInt64 builderRegistrationTimestampOverride = null; @Option( - names = {"--Xvalidators-proposer-blinded-blocks-enabled"}, + names = {"--validators-proposer-blinded-blocks-enabled"}, paramLabel = "", showDefaultValue = Visibility.ALWAYS, description = "Use blinded blocks when in block production duties", fallbackValue = "true", - hidden = true, arity = "0..1") private boolean blindedBlocksEnabled = DEFAULT_VALIDATOR_BLINDED_BLOCKS_ENABLED; @@ -109,10 +107,10 @@ public void configure(TekuConfiguration.Builder builder) { .proposerDefaultFeeRecipient(proposerDefaultFeeRecipient) .proposerConfigSource(proposerConfig) .refreshProposerConfigFromSource(proposerConfigRefreshEnabled) - .validatorsRegistrationDefaultEnabled(validatorsRegistrationDefaultEnabled) + .builderRegistrationDefaultEnabled(builderRegistrationDefaultEnabled) .blindedBeaconBlocksEnabled(blindedBlocksEnabled) - .validatorsRegistrationDefaultGasLimit(registrationDefaultGasLimit) - .validatorsRegistrationSendingBatchSize(registrationSendingBatchSize) - .validatorsRegistrationTimestampOverride(validatorsRegistrationTimestampOverride)); + .builderRegistrationDefaultGasLimit(builderRegistrationDefaultGasLimit) + .builderRegistrationSendingBatchSize(builderRegistrationSendingBatchSize) + .builderRegistrationTimestampOverride(builderRegistrationTimestampOverride)); } } diff --git a/teku/src/test/java/tech/pegasys/teku/cli/options/ExecutionLayerOptionsTest.java b/teku/src/test/java/tech/pegasys/teku/cli/options/ExecutionLayerOptionsTest.java index bec0cf9b0d7..e30948bee90 100644 --- a/teku/src/test/java/tech/pegasys/teku/cli/options/ExecutionLayerOptionsTest.java +++ b/teku/src/test/java/tech/pegasys/teku/cli/options/ExecutionLayerOptionsTest.java @@ -67,7 +67,7 @@ public void shouldAcceptEngineAndBuilderEndpointIfSpecEnablesBellatrix() { "1", "--ee-endpoint", "http://example.com:1234/path/", - "--Xeb-endpoint", + "--builder-endpoint", "http://example2.com:1234/path2/" }; final TekuConfiguration config = getTekuConfigurationFromArguments(args); diff --git a/teku/src/test/java/tech/pegasys/teku/cli/options/ValidatorOptionsTest.java b/teku/src/test/java/tech/pegasys/teku/cli/options/ValidatorOptionsTest.java index 959ee105dc9..c1c40194aa1 100644 --- a/teku/src/test/java/tech/pegasys/teku/cli/options/ValidatorOptionsTest.java +++ b/teku/src/test/java/tech/pegasys/teku/cli/options/ValidatorOptionsTest.java @@ -14,7 +14,7 @@ package tech.pegasys.teku.cli.options; import static org.assertj.core.api.Assertions.assertThat; -import static tech.pegasys.teku.validator.api.ValidatorConfig.DEFAULT_VALIDATOR_REGISTRATION_GAS_LIMIT; +import static tech.pegasys.teku.validator.api.ValidatorConfig.DEFAULT_BUILDER_REGISTRATION_GAS_LIMIT; import java.net.MalformedURLException; import java.net.URL; @@ -121,7 +121,7 @@ public void shouldReportAddressIfFeeRecipientSpecified() { @Test public void shouldEnableBlindedBeaconBlocks() { - final String[] args = {"--Xvalidators-proposer-blinded-blocks-enabled", "true"}; + final String[] args = {"--validators-proposer-blinded-blocks-enabled", "true"}; final TekuConfiguration config = getTekuConfigurationFromArguments(args); assertThat(config.validatorClient().getValidatorConfig().isBlindedBeaconBlocksEnabled()) .isTrue(); @@ -137,10 +137,9 @@ public void shouldNotUseBlindedBeaconBlocksByDefault() { @Test public void shouldEnableValidatorRegistrationtWithBlindedBlocks() { - final String[] args = {"--Xvalidators-registration-default-enabled", "true"}; + final String[] args = {"--validators-builder-registration-default-enabled", "true"}; final TekuConfiguration config = getTekuConfigurationFromArguments(args); - assertThat( - config.validatorClient().getValidatorConfig().isValidatorsRegistrationDefaultEnabled()) + assertThat(config.validatorClient().getValidatorConfig().isBuilderRegistrationDefaultEnabled()) .isTrue(); assertThat(config.validatorClient().getValidatorConfig().isBlindedBeaconBlocksEnabled()) .isTrue(); @@ -148,13 +147,10 @@ public void shouldEnableValidatorRegistrationtWithBlindedBlocks() { @Test public void shouldEnableValidatorRegistrationTimestampOverride() { - final String[] args = {"--Xvalidators-registration-timestamp-override", "120000"}; + final String[] args = {"--validators-builder-registration-timestamp-override", "120000"}; final TekuConfiguration config = getTekuConfigurationFromArguments(args); assertThat( - config - .validatorClient() - .getValidatorConfig() - .getValidatorsRegistrationTimestampOverride()) + config.validatorClient().getValidatorConfig().getBuilderRegistrationTimestampOverride()) .isEqualTo(Optional.of(UInt64.valueOf(120000))); } @@ -162,8 +158,7 @@ public void shouldEnableValidatorRegistrationTimestampOverride() { public void shouldNotUseValidatorsRegistrationByDefault() { final String[] args = {}; final TekuConfiguration config = getTekuConfigurationFromArguments(args); - assertThat( - config.validatorClient().getValidatorConfig().isValidatorsRegistrationDefaultEnabled()) + assertThat(config.validatorClient().getValidatorConfig().isBuilderRegistrationDefaultEnabled()) .isFalse(); } @@ -171,22 +166,16 @@ public void shouldNotUseValidatorsRegistrationByDefault() { public void shouldReportDefaultGasLimitIfRegistrationDefaultGasLimitNotSpecified() { final TekuConfiguration config = getTekuConfigurationFromArguments(); assertThat( - config - .validatorClient() - .getValidatorConfig() - .getValidatorsRegistrationDefaultGasLimit()) - .isEqualTo(DEFAULT_VALIDATOR_REGISTRATION_GAS_LIMIT); + config.validatorClient().getValidatorConfig().getBuilderRegistrationDefaultGasLimit()) + .isEqualTo(DEFAULT_BUILDER_REGISTRATION_GAS_LIMIT); } @Test public void shouldSETDefaultGasLimitIfRegistrationDefaultGasLimitIsSpecified() { - final String[] args = {"--Xvalidators-registration-default-gas-limit", "1000"}; + final String[] args = {"--Xvalidators-builder-registration-default-gas-limit", "1000"}; final TekuConfiguration config = getTekuConfigurationFromArguments(args); assertThat( - config - .validatorClient() - .getValidatorConfig() - .getValidatorsRegistrationDefaultGasLimit()) + config.validatorClient().getValidatorConfig().getBuilderRegistrationDefaultGasLimit()) .isEqualTo(UInt64.valueOf(1000)); } } diff --git a/validator/api/src/main/java/tech/pegasys/teku/validator/api/ValidatorConfig.java b/validator/api/src/main/java/tech/pegasys/teku/validator/api/ValidatorConfig.java index 161a4d219cf..a35afd89422 100644 --- a/validator/api/src/main/java/tech/pegasys/teku/validator/api/ValidatorConfig.java +++ b/validator/api/src/main/java/tech/pegasys/teku/validator/api/ValidatorConfig.java @@ -46,10 +46,10 @@ public class ValidatorConfig { public static final boolean DEFAULT_GENERATE_EARLY_ATTESTATIONS = true; public static final Optional DEFAULT_GRAFFITI = Optional.empty(); public static final boolean DEFAULT_VALIDATOR_PROPOSER_CONFIG_REFRESH_ENABLED = false; - public static final boolean DEFAULT_VALIDATOR_REGISTRATION_DEFAULT_ENABLED = false; + public static final boolean DEFAULT_BUILDER_REGISTRATION_DEFAULT_ENABLED = false; public static final boolean DEFAULT_VALIDATOR_BLINDED_BLOCKS_ENABLED = false; public static final int DEFAULT_VALIDATOR_REGISTRATION_SENDING_BATCH_SIZE = 100; - public static final UInt64 DEFAULT_VALIDATOR_REGISTRATION_GAS_LIMIT = UInt64.valueOf(30_000_000); + public static final UInt64 DEFAULT_BUILDER_REGISTRATION_GAS_LIMIT = UInt64.valueOf(30_000_000); private final List validatorKeys; private final List validatorExternalSignerPublicKeySources; @@ -71,11 +71,11 @@ public class ValidatorConfig { private final Optional proposerConfigSource; private final boolean refreshProposerConfigFromSource; private final boolean blindedBeaconBlocksEnabled; - private final boolean validatorsRegistrationDefaultEnabled; + private final boolean builderRegistrationDefaultEnabled; private final boolean validatorClientUseSszBlocksEnabled; - private final UInt64 validatorsRegistrationDefaultGasLimit; - private final int validatorsRegistrationSendingBatchSize; - private final Optional validatorsRegistrationTimestampOverride; + private final UInt64 builderRegistrationDefaultGasLimit; + private final int builderRegistrationSendingBatchSize; + private final Optional builderRegistrationTimestampOverride; private final int executorMaxQueueSize; @@ -99,12 +99,12 @@ private ValidatorConfig( final Optional proposerDefaultFeeRecipient, final Optional proposerConfigSource, final boolean refreshProposerConfigFromSource, - final boolean validatorsRegistrationDefaultEnabled, + final boolean builderRegistrationDefaultEnabled, final boolean blindedBeaconBlocksEnabled, final boolean validatorClientUseSszBlocksEnabled, - final UInt64 validatorsRegistrationDefaultGasLimit, - final int validatorsRegistrationSendingBatchSize, - final Optional validatorsRegistrationTimestampOverride, + final UInt64 builderRegistrationDefaultGasLimit, + final int builderRegistrationSendingBatchSize, + final Optional builderRegistrationTimestampOverride, final int executorMaxQueueSize) { this.validatorKeys = validatorKeys; this.validatorExternalSignerPublicKeySources = validatorExternalSignerPublicKeySources; @@ -129,11 +129,11 @@ private ValidatorConfig( this.proposerConfigSource = proposerConfigSource; this.refreshProposerConfigFromSource = refreshProposerConfigFromSource; this.blindedBeaconBlocksEnabled = blindedBeaconBlocksEnabled; - this.validatorsRegistrationDefaultEnabled = validatorsRegistrationDefaultEnabled; + this.builderRegistrationDefaultEnabled = builderRegistrationDefaultEnabled; this.validatorClientUseSszBlocksEnabled = validatorClientUseSszBlocksEnabled; - this.validatorsRegistrationDefaultGasLimit = validatorsRegistrationDefaultGasLimit; - this.validatorsRegistrationSendingBatchSize = validatorsRegistrationSendingBatchSize; - this.validatorsRegistrationTimestampOverride = validatorsRegistrationTimestampOverride; + this.builderRegistrationDefaultGasLimit = builderRegistrationDefaultGasLimit; + this.builderRegistrationSendingBatchSize = builderRegistrationSendingBatchSize; + this.builderRegistrationTimestampOverride = builderRegistrationTimestampOverride; this.executorMaxQueueSize = executorMaxQueueSize; } @@ -208,16 +208,16 @@ public Optional getProposerConfigSource() { return proposerConfigSource; } - public UInt64 getValidatorsRegistrationDefaultGasLimit() { - return validatorsRegistrationDefaultGasLimit; + public UInt64 getBuilderRegistrationDefaultGasLimit() { + return builderRegistrationDefaultGasLimit; } - public int getValidatorsRegistrationSendingBatchSize() { - return validatorsRegistrationSendingBatchSize; + public int getBuilderRegistrationSendingBatchSize() { + return builderRegistrationSendingBatchSize; } - public Optional getValidatorsRegistrationTimestampOverride() { - return validatorsRegistrationTimestampOverride; + public Optional getBuilderRegistrationTimestampOverride() { + return builderRegistrationTimestampOverride; } public boolean getRefreshProposerConfigFromSource() { @@ -232,8 +232,8 @@ public boolean isValidatorClientUseSszBlocksEnabled() { return validatorClientUseSszBlocksEnabled; } - public boolean isValidatorsRegistrationDefaultEnabled() { - return validatorsRegistrationDefaultEnabled; + public boolean isBuilderRegistrationDefaultEnabled() { + return builderRegistrationDefaultEnabled; } public int getExecutorMaxQueueSize() { @@ -275,13 +275,13 @@ public static final class Builder { private boolean refreshProposerConfigFromSource = DEFAULT_VALIDATOR_PROPOSER_CONFIG_REFRESH_ENABLED; private boolean validatorsRegistrationDefaultEnabled = - DEFAULT_VALIDATOR_REGISTRATION_DEFAULT_ENABLED; + DEFAULT_BUILDER_REGISTRATION_DEFAULT_ENABLED; private boolean blindedBlocksEnabled = DEFAULT_VALIDATOR_BLINDED_BLOCKS_ENABLED; private boolean validatorClientSszBlocksEnabled = DEFAULT_VALIDATOR_CLIENT_SSZ_BLOCKS_ENABLED; - private UInt64 validatorsRegistrationDefaultGasLimit = DEFAULT_VALIDATOR_REGISTRATION_GAS_LIMIT; - private int validatorsRegistrationSendingBatchSize = + private UInt64 builderRegistrationDefaultGasLimit = DEFAULT_BUILDER_REGISTRATION_GAS_LIMIT; + private int builderRegistrationSendingBatchSize = DEFAULT_VALIDATOR_REGISTRATION_SENDING_BATCH_SIZE; - private Optional validatorsRegistrationTimestampOverride = Optional.empty(); + private Optional builderRegistrationTimestampOverride = Optional.empty(); private int executorMaxQueueSize = DEFAULT_EXECUTOR_MAX_QUEUE_SIZE; private Builder() {} @@ -408,7 +408,7 @@ public Builder refreshProposerConfigFromSource(final boolean refreshProposerConf return this; } - public Builder validatorsRegistrationDefaultEnabled( + public Builder builderRegistrationDefaultEnabled( final boolean validatorsRegistrationDefaultEnabled) { this.validatorsRegistrationDefaultEnabled = validatorsRegistrationDefaultEnabled; return this; @@ -425,22 +425,22 @@ public Builder validatorClientUseSszBlocksEnabled( return this; } - public Builder validatorsRegistrationDefaultGasLimit( - final UInt64 validatorsRegistrationDefaultGasLimit) { - this.validatorsRegistrationDefaultGasLimit = validatorsRegistrationDefaultGasLimit; + public Builder builderRegistrationDefaultGasLimit( + final UInt64 builderRegistrationDefaultGasLimit) { + this.builderRegistrationDefaultGasLimit = builderRegistrationDefaultGasLimit; return this; } - public Builder validatorsRegistrationSendingBatchSize( - final int validatorsRegistrationSendingBatchSize) { - this.validatorsRegistrationSendingBatchSize = validatorsRegistrationSendingBatchSize; + public Builder builderRegistrationSendingBatchSize( + final int builderRegistrationSendingBatchSize) { + this.builderRegistrationSendingBatchSize = builderRegistrationSendingBatchSize; return this; } - public Builder validatorsRegistrationTimestampOverride( - final UInt64 validatorsRegistrationTimestampOverride) { - this.validatorsRegistrationTimestampOverride = - Optional.ofNullable(validatorsRegistrationTimestampOverride); + public Builder builderRegistrationTimestampOverride( + final UInt64 builderRegistrationTimestampOverride) { + this.builderRegistrationTimestampOverride = + Optional.ofNullable(builderRegistrationTimestampOverride); return this; } @@ -479,9 +479,9 @@ public ValidatorConfig build() { validatorsRegistrationDefaultEnabled, blindedBlocksEnabled, validatorClientSszBlocksEnabled, - validatorsRegistrationDefaultGasLimit, - validatorsRegistrationSendingBatchSize, - validatorsRegistrationTimestampOverride, + builderRegistrationDefaultGasLimit, + builderRegistrationSendingBatchSize, + builderRegistrationTimestampOverride, executorMaxQueueSize); } @@ -534,7 +534,7 @@ private void validateExternalSignerURLScheme() { private void validateValidatorsRegistrationAndBlindedBlocks() { if (validatorsRegistrationDefaultEnabled && !blindedBlocksEnabled) { LOG.info( - "'--Xvalidators-registration-default-enabled' requires '--Xvalidators-proposer-blinded-blocks-enabled', enabling it"); + "'--validators-builder-registration-default-enabled' requires '--validators-proposer-blinded-blocks-enabled', enabling it"); blindedBlocksEnabled = true; } } @@ -542,7 +542,7 @@ private void validateValidatorsRegistrationAndBlindedBlocks() { private void validatorsRegistrationDefaultEnabledOrProposerConfigSource() { if (validatorsRegistrationDefaultEnabled && proposerConfigSource.isPresent()) { throw new InvalidConfigurationException( - "Invalid configuration. --Xvalidators-registration-default-enabled cannot be specified when --validators-proposer-config is used"); + "Invalid configuration. --validators-builder-registration-default-enabled cannot be specified when --validators-proposer-config is used"); } } diff --git a/validator/api/src/test/java/tech/pegasys/teku/validator/api/ValidatorConfigTest.java b/validator/api/src/test/java/tech/pegasys/teku/validator/api/ValidatorConfigTest.java index 8a734d1717f..c4846256d53 100644 --- a/validator/api/src/test/java/tech/pegasys/teku/validator/api/ValidatorConfigTest.java +++ b/validator/api/src/test/java/tech/pegasys/teku/validator/api/ValidatorConfigTest.java @@ -101,12 +101,12 @@ public void shouldThrowIfExternalSignerTruststoreSpecifiedWithoutPasswordFile() public void shouldThrowIfValidatorsRegistrationDefaultEnabledAndValidatorProposerConfigSpecified() { final ValidatorConfig.Builder builder = - configBuilder.validatorsRegistrationDefaultEnabled(true).proposerConfigSource("somepath"); + configBuilder.builderRegistrationDefaultEnabled(true).proposerConfigSource("somepath"); Assertions.assertThatExceptionOfType(InvalidConfigurationException.class) .isThrownBy(builder::build) .withMessageContaining( - "Invalid configuration. --Xvalidators-registration-default-enabled cannot be specified when --validators-proposer-config is used"); + "Invalid configuration. --validators-builder-registration-default-enabled cannot be specified when --validators-proposer-config is used"); } @Test diff --git a/validator/client/src/main/java/tech/pegasys/teku/validator/client/BeaconProposerPreparer.java b/validator/client/src/main/java/tech/pegasys/teku/validator/client/BeaconProposerPreparer.java index d88349459c6..1fdfcf13c18 100644 --- a/validator/client/src/main/java/tech/pegasys/teku/validator/client/BeaconProposerPreparer.java +++ b/validator/client/src/main/java/tech/pegasys/teku/validator/client/BeaconProposerPreparer.java @@ -136,7 +136,7 @@ public Optional getFeeRecipient(final BLSPublicKey publicKey) { .or(() -> runtimeProposerConfig.getEth1AddressForPubKey(publicKey)) .or( () -> - maybeProposerConfig.map( + maybeProposerConfig.flatMap( proposerConfig -> proposerConfig.getDefaultConfig().getFeeRecipient())) .or(() -> defaultFeeRecipient); } @@ -226,7 +226,7 @@ private Collection buildBeaconPreparableProposerList( private Optional getFeeRecipientFromProposerConfig( final ProposerConfig config, final BLSPublicKey publicKey) { - return config.getConfigForPubKey(publicKey).map(Config::getFeeRecipient); + return config.getConfigForPubKey(publicKey).flatMap(Config::getFeeRecipient); } private boolean validatorIndexCannotBeResolved(final BLSPublicKey publicKey) { diff --git a/validator/client/src/main/java/tech/pegasys/teku/validator/client/ProposerConfig.java b/validator/client/src/main/java/tech/pegasys/teku/validator/client/ProposerConfig.java index f609b901e43..4860bd064f9 100644 --- a/validator/client/src/main/java/tech/pegasys/teku/validator/client/ProposerConfig.java +++ b/validator/client/src/main/java/tech/pegasys/teku/validator/client/ProposerConfig.java @@ -39,6 +39,7 @@ public ProposerConfig( @JsonProperty(value = "proposer_config") final Map proposerConfig, @JsonProperty(value = "default_config") final Config defaultConfig) { checkNotNull(defaultConfig, "default_config is required"); + checkNotNull(defaultConfig.feeRecipient, "fee_recipient is required in default_config"); this.proposerConfig = proposerConfig == null ? ImmutableMap.of() : proposerConfig; this.defaultConfig = defaultConfig; } @@ -59,16 +60,12 @@ public Config getConfigForPubKeyOrDefault(final BLSPublicKey pubKey) { return getConfigForPubKey(pubKey).orElse(defaultConfig); } - public Optional isValidatorRegistrationEnabledForPubKey(final BLSPublicKey pubKey) { - return getConfigForPubKeyOrDefault(pubKey) - .getValidatorRegistration() - .map(ValidatorRegistration::isEnabled); + public Optional isBuilderEnabledForPubKey(final BLSPublicKey pubKey) { + return getConfigForPubKeyOrDefault(pubKey).getBuilder().map(BuilderConfig::isEnabled); } - public Optional getValidatorRegistrationGasLimitForPubKey(final BLSPublicKey pubKey) { - return getConfigForPubKeyOrDefault(pubKey) - .getValidatorRegistration() - .flatMap(ValidatorRegistration::getGasLimit); + public Optional getBuilderGasLimitForPubKey(final BLSPublicKey pubKey) { + return getConfigForPubKeyOrDefault(pubKey).getBuilder().flatMap(BuilderConfig::getGasLimit); } public Config getDefaultConfig() { @@ -102,25 +99,23 @@ public static class Config { @JsonProperty(value = "fee_recipient") private Eth1Address feeRecipient; - @JsonProperty(value = "validator_registration") - private ValidatorRegistration validatorRegistration; + @JsonProperty(value = "builder") + private BuilderConfig builder; @JsonCreator public Config( @JsonProperty(value = "fee_recipient") final Eth1Address feeRecipient, - @JsonProperty(value = "validator_registration") - final ValidatorRegistration validatorRegistration) { - checkNotNull(feeRecipient, "fee_recipient is required"); + @JsonProperty(value = "builder") final BuilderConfig builder) { this.feeRecipient = feeRecipient; - this.validatorRegistration = validatorRegistration; + this.builder = builder; } - public Eth1Address getFeeRecipient() { - return feeRecipient; + public Optional getFeeRecipient() { + return Optional.ofNullable(feeRecipient); } - public Optional getValidatorRegistration() { - return Optional.ofNullable(validatorRegistration); + public Optional getBuilder() { + return Optional.ofNullable(builder); } @Override @@ -133,17 +128,17 @@ public boolean equals(final Object o) { } final Config that = (Config) o; return Objects.equals(feeRecipient, that.feeRecipient) - && Objects.equals(validatorRegistration, that.validatorRegistration); + && Objects.equals(builder, that.builder); } @Override public int hashCode() { - return Objects.hash(feeRecipient, validatorRegistration); + return Objects.hash(feeRecipient, builder); } } @JsonIgnoreProperties(ignoreUnknown = true) - public static class ValidatorRegistration { + public static class BuilderConfig { @JsonProperty(value = "enabled") private Boolean enabled; @@ -151,7 +146,7 @@ public static class ValidatorRegistration { private UInt64 gasLimit; @JsonCreator - public ValidatorRegistration( + public BuilderConfig( @JsonProperty(value = "enabled") final Boolean enabled, @JsonProperty(value = "gas_limit") final UInt64 gasLimit) { checkNotNull(enabled, "enabled is required"); @@ -175,7 +170,7 @@ public boolean equals(final Object o) { if (o == null || getClass() != o.getClass()) { return false; } - final ValidatorRegistration that = (ValidatorRegistration) o; + final BuilderConfig that = (BuilderConfig) o; return Objects.equals(enabled, that.enabled) && Objects.equals(gasLimit, that.gasLimit); } diff --git a/validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorClientService.java b/validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorClientService.java index a0e105e4f94..c1791845d72 100644 --- a/validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorClientService.java +++ b/validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorClientService.java @@ -187,7 +187,7 @@ public static ValidatorClientService create( validatorConfig, beaconProposerPreparer.get(), new ValidatorRegistrationBatchSender( - validatorConfig.getValidatorsRegistrationSendingBatchSize(), + validatorConfig.getBuilderRegistrationSendingBatchSize(), validatorApiChannel))); } if (validatorApiConfig.isRestApiEnabled()) { diff --git a/validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorRegistrator.java b/validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorRegistrator.java index 258ddeeb5fb..4c96fe97a1a 100644 --- a/validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorRegistrator.java +++ b/validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorRegistrator.java @@ -236,24 +236,22 @@ private Optional> createSignedValidatorR private boolean registrationIsEnabled( final Optional maybeProposerConfig, final BLSPublicKey publicKey) { return maybeProposerConfig - .flatMap( - proposerConfig -> proposerConfig.isValidatorRegistrationEnabledForPubKey(publicKey)) - .orElse(validatorConfig.isValidatorsRegistrationDefaultEnabled()); + .flatMap(proposerConfig -> proposerConfig.isBuilderEnabledForPubKey(publicKey)) + .orElse(validatorConfig.isBuilderRegistrationDefaultEnabled()); } private UInt64 getGasLimit( final Optional maybeProposerConfig, final BLSPublicKey publicKey) { return maybeProposerConfig - .flatMap( - proposerConfig -> proposerConfig.getValidatorRegistrationGasLimitForPubKey(publicKey)) - .orElse(validatorConfig.getValidatorsRegistrationDefaultGasLimit()); + .flatMap(proposerConfig -> proposerConfig.getBuilderGasLimitForPubKey(publicKey)) + .orElse(validatorConfig.getBuilderRegistrationDefaultGasLimit()); } private ValidatorRegistration createValidatorRegistration( final BLSPublicKey publicKey, final Eth1Address feeRecipient, final UInt64 gasLimit) { final UInt64 timestamp = validatorConfig - .getValidatorsRegistrationTimestampOverride() + .getBuilderRegistrationTimestampOverride() .orElse(timeProvider.getTimeInSeconds()); return ApiSchemas.VALIDATOR_REGISTRATION_SCHEMA.create( feeRecipient, gasLimit, timestamp, publicKey); diff --git a/validator/client/src/test/java/tech/pegasys/teku/validator/client/ProposerConfigTest.java b/validator/client/src/test/java/tech/pegasys/teku/validator/client/ProposerConfigTest.java index 5e3a716d1ab..284629cbab3 100644 --- a/validator/client/src/test/java/tech/pegasys/teku/validator/client/ProposerConfigTest.java +++ b/validator/client/src/test/java/tech/pegasys/teku/validator/client/ProposerConfigTest.java @@ -22,8 +22,8 @@ import tech.pegasys.teku.bls.BLSPublicKey; import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.spec.datastructures.eth1.Eth1Address; +import tech.pegasys.teku.validator.client.ProposerConfig.BuilderConfig; import tech.pegasys.teku.validator.client.ProposerConfig.Config; -import tech.pegasys.teku.validator.client.ProposerConfig.ValidatorRegistration; class ProposerConfigTest { @@ -36,41 +36,36 @@ class ProposerConfigTest { Bytes48.fromHexString( "0x89ece308f9d1f0131765212deca99697b112d61f9be9a5f1f3780a51335b3ff981747a0b2ca2179b96d2c0c9024e5224"); - private static final Config NO_VALIDATOR_REGISTRATION_CONFIG = new Config(ETH1_ADDRESS, null); + private static final Config NO_BUILDER_CONFIG = new Config(ETH1_ADDRESS, null); private static final UInt64 DEFAULT_GAS_LIMIT = UInt64.valueOf(30_000_000); private static final UInt64 CUSTOM_GAS_LIMIT = UInt64.valueOf(28_000_000); private static final Config DEFAULT_CONFIG = - new Config(ETH1_ADDRESS, new ValidatorRegistration(false, DEFAULT_GAS_LIMIT)); + new Config(ETH1_ADDRESS, new BuilderConfig(false, DEFAULT_GAS_LIMIT)); @Test void gets_isValidatorRegistrationEnabled_forPubKey() { Map configByPubKey = new HashMap<>(); configByPubKey.put( - PUB_KEY, new Config(ETH1_ADDRESS, new ValidatorRegistration(true, CUSTOM_GAS_LIMIT))); + PUB_KEY, new Config(ETH1_ADDRESS, new BuilderConfig(true, CUSTOM_GAS_LIMIT))); ProposerConfig proposerConfig = new ProposerConfig(configByPubKey, DEFAULT_CONFIG); - assertThat( - proposerConfig.isValidatorRegistrationEnabledForPubKey( - BLSPublicKey.fromBytesCompressed(PUB_KEY))) + assertThat(proposerConfig.isBuilderEnabledForPubKey(BLSPublicKey.fromBytesCompressed(PUB_KEY))) .hasValue(true); // defaults to default config assertThat( - proposerConfig.isValidatorRegistrationEnabledForPubKey( + proposerConfig.isBuilderEnabledForPubKey( BLSPublicKey.fromBytesCompressed(ANOTHER_PUB_KEY))) .hasValue(false); } @Test void registrationIsNotEnabledDoesNotExist_whenRegistrationIsNull() { - ProposerConfig proposerConfig = - new ProposerConfig(new HashMap<>(), NO_VALIDATOR_REGISTRATION_CONFIG); + ProposerConfig proposerConfig = new ProposerConfig(new HashMap<>(), NO_BUILDER_CONFIG); - assertThat( - proposerConfig.isValidatorRegistrationEnabledForPubKey( - BLSPublicKey.fromBytesCompressed(PUB_KEY))) + assertThat(proposerConfig.isBuilderEnabledForPubKey(BLSPublicKey.fromBytesCompressed(PUB_KEY))) .isEmpty(); } @@ -78,41 +73,37 @@ void registrationIsNotEnabledDoesNotExist_whenRegistrationIsNull() { void gets_validatorRegistrationGasLimit_forPubKey() { Map configByPubKey = new HashMap<>(); configByPubKey.put( - PUB_KEY, new Config(ETH1_ADDRESS, new ValidatorRegistration(true, CUSTOM_GAS_LIMIT))); + PUB_KEY, new Config(ETH1_ADDRESS, new BuilderConfig(true, CUSTOM_GAS_LIMIT))); ProposerConfig proposerConfig = new ProposerConfig(configByPubKey, DEFAULT_CONFIG); assertThat( - proposerConfig.getValidatorRegistrationGasLimitForPubKey( - BLSPublicKey.fromBytesCompressed(PUB_KEY))) + proposerConfig.getBuilderGasLimitForPubKey(BLSPublicKey.fromBytesCompressed(PUB_KEY))) .hasValue(CUSTOM_GAS_LIMIT); // defaults to default config assertThat( - proposerConfig.getValidatorRegistrationGasLimitForPubKey( + proposerConfig.getBuilderGasLimitForPubKey( BLSPublicKey.fromBytesCompressed(ANOTHER_PUB_KEY))) .hasValue(DEFAULT_GAS_LIMIT); } @Test void registrationGasLimitDoesNotExist_whenRegistrationIsNull() { - ProposerConfig proposerConfig = - new ProposerConfig(new HashMap<>(), NO_VALIDATOR_REGISTRATION_CONFIG); + ProposerConfig proposerConfig = new ProposerConfig(new HashMap<>(), NO_BUILDER_CONFIG); assertThat( - proposerConfig.getValidatorRegistrationGasLimitForPubKey( - BLSPublicKey.fromBytesCompressed(PUB_KEY))) + proposerConfig.getBuilderGasLimitForPubKey(BLSPublicKey.fromBytesCompressed(PUB_KEY))) .isEmpty(); } @Test void registrationGasLimitDoesNotExist_whenGasLimitIsNull() { Map configByPubKey = new HashMap<>(); - configByPubKey.put(PUB_KEY, new Config(ETH1_ADDRESS, new ValidatorRegistration(true, null))); + configByPubKey.put(PUB_KEY, new Config(ETH1_ADDRESS, new BuilderConfig(true, null))); ProposerConfig proposerConfig = new ProposerConfig(configByPubKey, DEFAULT_CONFIG); assertThat( - proposerConfig.getValidatorRegistrationGasLimitForPubKey( - BLSPublicKey.fromBytesCompressed(PUB_KEY))) + proposerConfig.getBuilderGasLimitForPubKey(BLSPublicKey.fromBytesCompressed(PUB_KEY))) .isEmpty(); } } diff --git a/validator/client/src/test/java/tech/pegasys/teku/validator/client/ValidatorRegistratorTest.java b/validator/client/src/test/java/tech/pegasys/teku/validator/client/ValidatorRegistratorTest.java index 37988758613..84cbabdb628 100644 --- a/validator/client/src/test/java/tech/pegasys/teku/validator/client/ValidatorRegistratorTest.java +++ b/validator/client/src/test/java/tech/pegasys/teku/validator/client/ValidatorRegistratorTest.java @@ -98,10 +98,8 @@ void setUp(SpecContext specContext) { when(proposerConfigProvider.getProposerConfig()) .thenReturn(SafeFuture.completedFuture(Optional.of(proposerConfig))); - when(proposerConfig.isValidatorRegistrationEnabledForPubKey(any())) - .thenReturn(Optional.of(true)); - when(proposerConfig.getValidatorRegistrationGasLimitForPubKey(any())) - .thenReturn(Optional.of(gasLimit)); + when(proposerConfig.isBuilderEnabledForPubKey(any())).thenReturn(Optional.of(true)); + when(proposerConfig.getBuilderGasLimitForPubKey(any())).thenReturn(Optional.of(gasLimit)); when(feeRecipientProvider.isReadyToProvideFeeRecipient()).thenReturn(true); when(feeRecipientProvider.getFeeRecipient(any())).thenReturn(Optional.of(eth1Address)); @@ -156,7 +154,7 @@ void registersValidators_onBeginningOfEpoch() { @TestTemplate void registersValidators_shouldRegisterWithTimestampOverride() { - when(validatorConfig.getValidatorsRegistrationTimestampOverride()) + when(validatorConfig.getBuilderRegistrationTimestampOverride()) .thenReturn(Optional.of(UInt64.valueOf(140))); setActiveValidators(validator1); @@ -201,7 +199,7 @@ void doesNotUseCache_ifRegistrationsNeedUpdating() { .thenReturn(Optional.of(otherEth1Address)); // gas limit changed for validator3 - when(proposerConfig.getValidatorRegistrationGasLimitForPubKey(validator3.getPublicKey())) + when(proposerConfig.getBuilderGasLimitForPubKey(validator3.getPublicKey())) .thenReturn(Optional.of(otherGasLimit)); runRegistrationFlowForSlot(UInt64.valueOf(slotsPerEpoch)); @@ -276,13 +274,13 @@ void skipsValidatorRegistrationIfRegistrationNotEnabled() { setActiveValidators(validator1, validator2, validator3); // validator registration is disabled for validator2 - when(proposerConfig.isValidatorRegistrationEnabledForPubKey(validator2.getPublicKey())) + when(proposerConfig.isBuilderEnabledForPubKey(validator2.getPublicKey())) .thenReturn(Optional.of(false)); // validator registration enabled flag is not present for validator 3, so will fall back to // false - when(proposerConfig.isValidatorRegistrationEnabledForPubKey(validator3.getPublicKey())) + when(proposerConfig.isBuilderEnabledForPubKey(validator3.getPublicKey())) .thenReturn(Optional.empty()); - when(validatorConfig.isValidatorsRegistrationDefaultEnabled()).thenReturn(false); + when(validatorConfig.isBuilderRegistrationDefaultEnabled()).thenReturn(false); runRegistrationFlowForSlot(UInt64.ZERO); @@ -298,12 +296,12 @@ void retrievesCorrectGasLimitForValidators() { final UInt64 defaultGasLimit = UInt64.valueOf(27_000_000); // validator2 will have custom gas limit - when(proposerConfig.getValidatorRegistrationGasLimitForPubKey(validator2.getPublicKey())) + when(proposerConfig.getBuilderGasLimitForPubKey(validator2.getPublicKey())) .thenReturn(Optional.of(validator2GasLimit)); // validator3 gas limit will fall back to a default - when(proposerConfig.getValidatorRegistrationGasLimitForPubKey(validator3.getPublicKey())) + when(proposerConfig.getBuilderGasLimitForPubKey(validator3.getPublicKey())) .thenReturn(Optional.empty()); - when(validatorConfig.getValidatorsRegistrationDefaultGasLimit()).thenReturn(defaultGasLimit); + when(validatorConfig.getBuilderRegistrationDefaultGasLimit()).thenReturn(defaultGasLimit); runRegistrationFlowForSlot(UInt64.ZERO); @@ -380,7 +378,7 @@ private void verifyRegistrations( final UInt64 expectedTimestamp = validatorConfig - .getValidatorsRegistrationTimestampOverride() + .getBuilderRegistrationTimestampOverride() .orElse(stubTimeProvider.getTimeInSeconds()); assertThat(validatorRegistrations) diff --git a/validator/client/src/test/java/tech/pegasys/teku/validator/client/proposerconfig/loader/ProposerConfigLoaderTest.java b/validator/client/src/test/java/tech/pegasys/teku/validator/client/proposerconfig/loader/ProposerConfigLoaderTest.java index 5248cd2e8d0..0a13c1b4897 100644 --- a/validator/client/src/test/java/tech/pegasys/teku/validator/client/proposerconfig/loader/ProposerConfigLoaderTest.java +++ b/validator/client/src/test/java/tech/pegasys/teku/validator/client/proposerconfig/loader/ProposerConfigLoaderTest.java @@ -23,6 +23,7 @@ import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.spec.datastructures.eth1.Eth1Address; import tech.pegasys.teku.validator.client.ProposerConfig; +import tech.pegasys.teku.validator.client.ProposerConfig.BuilderConfig; import tech.pegasys.teku.validator.client.ProposerConfig.Config; public class ProposerConfigLoaderTest { @@ -42,16 +43,23 @@ void shouldLoadConfigWithEmptyProposerConfig() { validateContent2(loader.getProposerConfig(resource)); } + @Test + void shouldLoadNullFeeRecipient() { + final URL resource = Resources.getResource("proposerConfigValid3.json"); + + validateContent3(loader.getProposerConfig(resource)); + } + @Test void shouldLoadConfigWithOnlyDefaultValidatorRegistrationEnabled() { - final URL resource = Resources.getResource("proposerConfigWithRegistrationValid1.json"); + final URL resource = Resources.getResource("proposerConfigWithBuilderValid1.json"); validateContentWithValidatorRegistration1(loader.getProposerConfig(resource)); } @Test void shouldLoadConfigWithDefaultValidatorRegistrationDisabled() { - final URL resource = Resources.getResource("proposerConfigWithRegistrationValid2.json"); + final URL resource = Resources.getResource("proposerConfigWithBuilderValid2.json"); validateContentWithValidatorRegistration2(loader.getProposerConfig(resource)); } @@ -64,7 +72,7 @@ void shouldNotLoadInvalidPubKey() { } @Test - void shouldNotLoadNullFeeRecipient() { + void shouldNodLoadNullFeeRecipientInDefaultConfig() { final URL resource = Resources.getResource("proposerConfigInvalid2.json"); assertThatThrownBy(() -> loader.getProposerConfig(resource)); @@ -86,7 +94,7 @@ void shouldNotLoadMissingFeeRecipient() { @Test void shouldNotLoadMissingEnabledInRegistration() { - final URL resource = Resources.getResource("proposerConfigWithRegistrationInvalid1.json"); + final URL resource = Resources.getResource("proposerConfigWithBuilderInvalid1.json"); assertThatThrownBy(() -> loader.getProposerConfig(resource)); } @@ -104,11 +112,13 @@ private void validateContent1(ProposerConfig config) { "0xa057816155ad77931185101128655c0191bd0214c201ca48ed887f6c4c6adf334070efcd75140eada5ac83a92506dd7a"); assertThat(theConfig).isPresent(); assertThat(theConfig.get().getFeeRecipient()) - .isEqualTo(Eth1Address.fromHexString("0x50155530FCE8a85ec7055A5F8b2bE214B3DaeFd3")); + .isEqualTo( + Optional.of(Eth1Address.fromHexString("0x50155530FCE8a85ec7055A5F8b2bE214B3DaeFd3"))); Config defaultConfig = config.getDefaultConfig(); assertThat(defaultConfig.getFeeRecipient()) - .isEqualTo(Eth1Address.fromHexString("0x6e35733c5af9B61374A128e6F85f553aF09ff89A")); + .isEqualTo( + Optional.of(Eth1Address.fromHexString("0x6e35733c5af9B61374A128e6F85f553aF09ff89A"))); } private void validateContent2(ProposerConfig config) { @@ -119,7 +129,21 @@ private void validateContent2(ProposerConfig config) { Config defaultConfig = config.getDefaultConfig(); assertThat(defaultConfig.getFeeRecipient()) - .isEqualTo(Eth1Address.fromHexString("0x6e35733c5af9B61374A128e6F85f553aF09ff89A")); + .isEqualTo( + Optional.of(Eth1Address.fromHexString("0x6e35733c5af9B61374A128e6F85f553aF09ff89A"))); + } + + private void validateContent3(ProposerConfig config) { + Optional theConfig = + config.getConfigForPubKey( + "0xa057816155ad77931185101128655c0191bd0214c201ca48ed887f6c4c6adf334070efcd75140eada5ac83a92506dd7a"); + assertThat(theConfig).isPresent(); + assertThat(theConfig.get().getFeeRecipient()).isEmpty(); + + Config defaultConfig = config.getDefaultConfig(); + assertThat(defaultConfig.getFeeRecipient()) + .isEqualTo( + Optional.of(Eth1Address.fromHexString("0x6e35733c5af9B61374A128e6F85f553aF09ff89A"))); } private void validateContentWithValidatorRegistration1(ProposerConfig config) { @@ -130,10 +154,11 @@ private void validateContentWithValidatorRegistration1(ProposerConfig config) { Config defaultConfig = config.getDefaultConfig(); assertThat(defaultConfig.getFeeRecipient()) - .isEqualTo(Eth1Address.fromHexString("0x6e35733c5af9B61374A128e6F85f553aF09ff89A")); + .isEqualTo( + Optional.of(Eth1Address.fromHexString("0x6e35733c5af9B61374A128e6F85f553aF09ff89A"))); - assertThat(defaultConfig.getValidatorRegistration()).isPresent(); - assertThat(defaultConfig.getValidatorRegistration().get().isEnabled()).isTrue(); + assertThat(defaultConfig.getBuilder()).isPresent(); + assertThat(defaultConfig.getBuilder().get().isEnabled()).isTrue(); } private void validateContentWithValidatorRegistration2(ProposerConfig config) { @@ -142,21 +167,21 @@ private void validateContentWithValidatorRegistration2(ProposerConfig config) { "0xa057816155ad77931185101128655c0191bd0214c201ca48ed887f6c4c6adf334070efcd75140eada5ac83a92506dd7a"); assertThat(theConfig).isPresent(); assertThat(theConfig.get().getFeeRecipient()) - .isEqualTo(Eth1Address.fromHexString("0x50155530FCE8a85ec7055A5F8b2bE214B3DaeFd3")); + .isEqualTo( + Optional.of(Eth1Address.fromHexString("0x50155530FCE8a85ec7055A5F8b2bE214B3DaeFd3"))); - assertThat(theConfig.get().getValidatorRegistration()).isPresent(); - ProposerConfig.ValidatorRegistration validatorRegistration = - theConfig.get().getValidatorRegistration().get(); - assertThat(validatorRegistration.isEnabled()).isTrue(); - assertThat(validatorRegistration.getGasLimit().orElseThrow()) - .isEqualTo(UInt64.valueOf(12345654321L)); + assertThat(theConfig.get().getBuilder()).isPresent(); + BuilderConfig builder = theConfig.get().getBuilder().get(); + assertThat(builder.isEnabled()).isTrue(); + assertThat(builder.getGasLimit().orElseThrow()).isEqualTo(UInt64.valueOf(12345654321L)); Config defaultConfig = config.getDefaultConfig(); assertThat(defaultConfig.getFeeRecipient()) - .isEqualTo(Eth1Address.fromHexString("0x6e35733c5af9B61374A128e6F85f553aF09ff89A")); + .isEqualTo( + Optional.of(Eth1Address.fromHexString("0x6e35733c5af9B61374A128e6F85f553aF09ff89A"))); - assertThat(defaultConfig.getValidatorRegistration()).isPresent(); - assertThat(defaultConfig.getValidatorRegistration().get().isEnabled()).isFalse(); - assertThat(defaultConfig.getValidatorRegistration().get().getGasLimit()).isEmpty(); + assertThat(defaultConfig.getBuilder()).isPresent(); + assertThat(defaultConfig.getBuilder().get().isEnabled()).isFalse(); + assertThat(defaultConfig.getBuilder().get().getGasLimit()).isEmpty(); } } diff --git a/validator/client/src/test/resources/proposerConfigInvalid2.json b/validator/client/src/test/resources/proposerConfigInvalid2.json index 9ffef435310..496a6bfc386 100644 --- a/validator/client/src/test/resources/proposerConfigInvalid2.json +++ b/validator/client/src/test/resources/proposerConfigInvalid2.json @@ -5,6 +5,6 @@ } }, "default_config": { - "fee_recipient": "0x6e35733c5af9B61374A128e6F85f553aF09ff89A" + "fee_recipient": null } } \ No newline at end of file diff --git a/validator/client/src/test/resources/proposerConfigValid3.json b/validator/client/src/test/resources/proposerConfigValid3.json new file mode 100644 index 00000000000..ddb459701b1 --- /dev/null +++ b/validator/client/src/test/resources/proposerConfigValid3.json @@ -0,0 +1,9 @@ +{ + "proposer_config": { + "0xa057816155ad77931185101128655c0191bd0214c201ca48ed887f6c4c6adf334070efcd75140eada5ac83a92506dd7a": { + } + }, + "default_config": { + "fee_recipient": "0x6e35733c5af9B61374A128e6F85f553aF09ff89A" + } +} \ No newline at end of file diff --git a/validator/client/src/test/resources/proposerConfigWithRegistrationInvalid1.json b/validator/client/src/test/resources/proposerConfigWithBuilderInvalid1.json similarity index 91% rename from validator/client/src/test/resources/proposerConfigWithRegistrationInvalid1.json rename to validator/client/src/test/resources/proposerConfigWithBuilderInvalid1.json index 3aa00bd779b..c263d942cc0 100644 --- a/validator/client/src/test/resources/proposerConfigWithRegistrationInvalid1.json +++ b/validator/client/src/test/resources/proposerConfigWithBuilderInvalid1.json @@ -2,7 +2,7 @@ "proposer_config": { "0xa057816155ad77931185101128655c0191bd0214c201ca48ed887f6c4c6adf334070efcd75140eada5ac83a92506dd7a": { "fee_recipient": "0x50155530FCE8a85ec7055A5F8b2bE214B3DaeFd3", - "validator_registration": { + "builder": { "gas_limit": "12345654321" } } diff --git a/validator/client/src/test/resources/proposerConfigWithRegistrationValid1.json b/validator/client/src/test/resources/proposerConfigWithBuilderValid1.json similarity index 79% rename from validator/client/src/test/resources/proposerConfigWithRegistrationValid1.json rename to validator/client/src/test/resources/proposerConfigWithBuilderValid1.json index 8cc77c634a1..db748a71c53 100644 --- a/validator/client/src/test/resources/proposerConfigWithRegistrationValid1.json +++ b/validator/client/src/test/resources/proposerConfigWithBuilderValid1.json @@ -1,7 +1,7 @@ { "default_config": { "fee_recipient": "0x6e35733c5af9B61374A128e6F85f553aF09ff89A", - "validator_registration": { + "builder": { "enabled": true } } diff --git a/validator/client/src/test/resources/proposerConfigWithRegistrationValid2.json b/validator/client/src/test/resources/proposerConfigWithBuilderValid2.json similarity index 85% rename from validator/client/src/test/resources/proposerConfigWithRegistrationValid2.json rename to validator/client/src/test/resources/proposerConfigWithBuilderValid2.json index 6ef66fa73e6..8aedf99497c 100644 --- a/validator/client/src/test/resources/proposerConfigWithRegistrationValid2.json +++ b/validator/client/src/test/resources/proposerConfigWithBuilderValid2.json @@ -2,7 +2,7 @@ "proposer_config": { "0xa057816155ad77931185101128655c0191bd0214c201ca48ed887f6c4c6adf334070efcd75140eada5ac83a92506dd7a": { "fee_recipient": "0x50155530FCE8a85ec7055A5F8b2bE214B3DaeFd3", - "validator_registration": { + "builder": { "enabled": true, "gas_limit": "12345654321" } @@ -10,7 +10,7 @@ }, "default_config": { "fee_recipient": "0x6e35733c5af9B61374A128e6F85f553aF09ff89A", - "validator_registration": { + "builder": { "enabled": false } }