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 8662f63c294..1c4a323a354 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 @@ -35,15 +35,13 @@ import tech.pegasys.teku.validator.client.ProposerConfig.Config; import tech.pegasys.teku.validator.client.proposerconfig.ProposerConfigProvider; -public class BeaconProposerPreparer - implements ValidatorTimingChannel, ValidatorRegistrationPropertiesProvider { +public class BeaconProposerPreparer implements ValidatorTimingChannel, FeeRecipientProvider { private static final Logger LOG = LogManager.getLogger(); private final ValidatorApiChannel validatorApiChannel; private Optional validatorIndexProvider; private final ProposerConfigProvider proposerConfigProvider; private final Optional defaultFeeRecipient; - private final UInt64 defaultGasLimit; private final Spec spec; private final RuntimeProposerConfig runtimeProposerConfig; @@ -53,35 +51,31 @@ public class BeaconProposerPreparer private final AtomicBoolean sentProposersAtLeastOnce = new AtomicBoolean(false); BeaconProposerPreparer( - final ValidatorApiChannel validatorApiChannel, - final ValidatorIndexProvider validatorIndexProvider, - final ProposerConfigProvider proposerConfigProvider, - final Optional defaultFeeRecipient, - final UInt64 defaultGasLimit, - final Spec spec) { + ValidatorApiChannel validatorApiChannel, + ValidatorIndexProvider validatorIndexProvider, + ProposerConfigProvider proposerConfigProvider, + Optional defaultFeeRecipient, + Spec spec) { this( validatorApiChannel, Optional.of(validatorIndexProvider), proposerConfigProvider, defaultFeeRecipient, - defaultGasLimit, spec, Optional.empty()); } public BeaconProposerPreparer( - final ValidatorApiChannel validatorApiChannel, - final Optional validatorIndexProvider, - final ProposerConfigProvider proposerConfigProvider, - final Optional defaultFeeRecipient, - final UInt64 defaultGasLimit, - final Spec spec, - final Optional mutableProposerConfigPath) { + ValidatorApiChannel validatorApiChannel, + Optional validatorIndexProvider, + ProposerConfigProvider proposerConfigProvider, + Optional defaultFeeRecipient, + Spec spec, + Optional mutableProposerConfigPath) { this.validatorApiChannel = validatorApiChannel; this.validatorIndexProvider = validatorIndexProvider; this.proposerConfigProvider = proposerConfigProvider; this.defaultFeeRecipient = defaultFeeRecipient; - this.defaultGasLimit = defaultGasLimit; this.spec = spec; runtimeProposerConfig = new RuntimeProposerConfig(mutableProposerConfigPath); } @@ -91,7 +85,7 @@ public void initialize(final Optional provider) { } @Override - public void onSlot(final UInt64 slot) { + public void onSlot(UInt64 slot) { if (validatorIndexProvider.isEmpty()) { return; } @@ -102,10 +96,10 @@ public void onSlot(final UInt64 slot) { @Override public void onHeadUpdate( - final UInt64 slot, - final Bytes32 previousDutyDependentRoot, - final Bytes32 currentDutyDependentRoot, - final Bytes32 headBlockRoot) {} + UInt64 slot, + Bytes32 previousDutyDependentRoot, + Bytes32 currentDutyDependentRoot, + Bytes32 headBlockRoot) {} @Override public void onPossibleMissedEvents() { @@ -118,13 +112,13 @@ public void onValidatorsAdded() { } @Override - public void onBlockProductionDue(final UInt64 slot) {} + public void onBlockProductionDue(UInt64 slot) {} @Override - public void onAttestationCreationDue(final UInt64 slot) {} + public void onAttestationCreationDue(UInt64 slot) {} @Override - public void onAttestationAggregationDue(final UInt64 slot) {} + public void onAttestationAggregationDue(UInt64 slot) {} // 2 configurations, 2 defaults // Priority order @@ -147,22 +141,6 @@ public Optional getFeeRecipient(final BLSPublicKey publicKey) { .or(() -> defaultFeeRecipient); } - @Override - public Optional getGasLimit(final BLSPublicKey publicKey) { - if (validatorIndexCannotBeResolved(publicKey)) { - return Optional.empty(); - } - return maybeProposerConfig - .flatMap(config -> getGasLimitFromProposerConfig(config, publicKey)) - .or(() -> runtimeProposerConfig.getGasLimitForPubKey(publicKey)) - .or( - () -> - maybeProposerConfig.flatMap( - proposerConfigProvider -> - proposerConfigProvider.getDefaultConfig().getGasLimit())) - .or(() -> Optional.ofNullable(defaultGasLimit)); - } - @Override public boolean isReadyToProvideFeeRecipient() { return sentProposersAtLeastOnce.get(); @@ -182,25 +160,12 @@ public void setFeeRecipient(final BLSPublicKey publicKey, final Eth1Address eth1 Optional maybeEth1Address = maybeProposerConfig.flatMap(config -> getFeeRecipientFromProposerConfig(config, publicKey)); if (maybeEth1Address.isPresent()) { - throw new SetFeeRecipientException("Cannot update fee recipient via api."); + throw new SetFeeRecipientException( + "Validator public key has been configured in validators-proposer-config file - cannot update via api."); } runtimeProposerConfig.addOrUpdateFeeRecipient(publicKey, eth1Address); } - public void setGasLimit(final BLSPublicKey publicKey, final UInt64 gasLimit) - throws SetFeeRecipientException { - if (validatorIndexCannotBeResolved(publicKey)) { - throw new SetGasLimitException( - "Validator public key not found when attempting to set gas limit."); - } - Optional maybeGasLimit = - maybeProposerConfig.flatMap(config -> getGasLimitFromProposerConfig(config, publicKey)); - if (maybeGasLimit.isPresent()) { - throw new SetGasLimitException("Cannot update gas limit via api."); - } - runtimeProposerConfig.addOrUpdateGasLimit(publicKey, gasLimit); - } - public boolean deleteFeeRecipient(final BLSPublicKey publicKey) { Optional maybeEth1Address = maybeProposerConfig.flatMap(config -> getFeeRecipientFromProposerConfig(config, publicKey)); @@ -211,16 +176,6 @@ public boolean deleteFeeRecipient(final BLSPublicKey publicKey) { return true; } - public boolean deleteGasLimit(final BLSPublicKey publicKey) { - Optional maybeGasLimit = - maybeProposerConfig.flatMap(config -> getGasLimitFromProposerConfig(config, publicKey)); - if (maybeGasLimit.isPresent()) { - return false; - } - runtimeProposerConfig.deleteGasLimit(publicKey); - return true; - } - private boolean isBeginningOfEpoch(final UInt64 slot) { return slot.mod(spec.getSlotsPerEpoch(slot)).isZero(); } @@ -254,8 +209,8 @@ private void sendPreparableProposerList() { } private Collection buildBeaconPreparableProposerList( - final Optional maybeProposerConfig, - final Map blsPublicKeyToIndexMap) { + Optional maybeProposerConfig, + Map blsPublicKeyToIndexMap) { this.maybeProposerConfig = maybeProposerConfig; return blsPublicKeyToIndexMap.entrySet().stream() .map( @@ -274,11 +229,6 @@ private Optional getFeeRecipientFromProposerConfig( return config.getConfigForPubKey(publicKey).flatMap(Config::getFeeRecipient); } - private Optional getGasLimitFromProposerConfig( - final ProposerConfig config, final BLSPublicKey publicKey) { - return config.getConfigForPubKey(publicKey).flatMap(Config::getGasLimit); - } - private boolean validatorIndexCannotBeResolved(final BLSPublicKey publicKey) { return validatorIndexProvider.isEmpty() || !validatorIndexProvider.get().containsPublicKey(publicKey); diff --git a/validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorRegistrationPropertiesProvider.java b/validator/client/src/main/java/tech/pegasys/teku/validator/client/FeeRecipientProvider.java similarity index 83% rename from validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorRegistrationPropertiesProvider.java rename to validator/client/src/main/java/tech/pegasys/teku/validator/client/FeeRecipientProvider.java index f5ee9109d30..fbf606ef6d5 100644 --- a/validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorRegistrationPropertiesProvider.java +++ b/validator/client/src/main/java/tech/pegasys/teku/validator/client/FeeRecipientProvider.java @@ -15,14 +15,11 @@ import java.util.Optional; import tech.pegasys.teku.bls.BLSPublicKey; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.spec.datastructures.eth1.Eth1Address; -public interface ValidatorRegistrationPropertiesProvider { +public interface FeeRecipientProvider { Optional getFeeRecipient(BLSPublicKey publicKey); - Optional getGasLimit(BLSPublicKey publicKey); - boolean isReadyToProvideFeeRecipient(); } 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 c74fcf7d05e..55662406e66 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 @@ -121,10 +121,6 @@ public Optional getFeeRecipient() { return Optional.ofNullable(feeRecipient); } - public Optional getGasLimit() { - return builder.getGasLimit(); - } - public Optional getBuilder() { return Optional.ofNullable(builder); } diff --git a/validator/client/src/main/java/tech/pegasys/teku/validator/client/SetGasLimitException.java b/validator/client/src/main/java/tech/pegasys/teku/validator/client/SetGasLimitException.java deleted file mode 100644 index ddf293acf27..00000000000 --- a/validator/client/src/main/java/tech/pegasys/teku/validator/client/SetGasLimitException.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright ConsenSys Software Inc., 2022 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.validator.client; - -public class SetGasLimitException extends IllegalArgumentException { - - public SetGasLimitException(String message) { - super(message); - } -} 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 5db90e63e69..c60d8ca2a45 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 @@ -165,7 +165,6 @@ public static ValidatorClientService create( Optional.empty(), proposerConfigProvider.get(), validatorConfig.getProposerDefaultFeeRecipient(), - validatorConfig.getBuilderRegistrationDefaultGasLimit(), config.getSpec(), Optional.of( ValidatorClientService.getKeyManagerPath(services.getDataDirLayout()) 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 576dd702c0b..c55c28af4d8 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 @@ -60,7 +60,7 @@ public class ValidatorRegistrator implements ValidatorTimingChannel { private final OwnedValidators ownedValidators; private final ProposerConfigProvider proposerConfigProvider; private final ValidatorConfig validatorConfig; - private final ValidatorRegistrationPropertiesProvider validatorRegistrationPropertiesProvider; + private final FeeRecipientProvider feeRecipientProvider; private final ValidatorRegistrationBatchSender validatorRegistrationBatchSender; public ValidatorRegistrator( @@ -69,13 +69,13 @@ public ValidatorRegistrator( final OwnedValidators ownedValidators, final ProposerConfigProvider proposerConfigProvider, final ValidatorConfig validatorConfig, - final ValidatorRegistrationPropertiesProvider validatorRegistrationPropertiesProvider, + final FeeRecipientProvider feeRecipientProvider, final ValidatorRegistrationBatchSender validatorRegistrationBatchSender) { this.spec = spec; this.timeProvider = timeProvider; this.ownedValidators = ownedValidators; this.proposerConfigProvider = proposerConfigProvider; - this.validatorRegistrationPropertiesProvider = validatorRegistrationPropertiesProvider; + this.feeRecipientProvider = feeRecipientProvider; this.validatorRegistrationBatchSender = validatorRegistrationBatchSender; this.validatorConfig = validatorConfig; } @@ -143,7 +143,7 @@ public int getNumberOfCachedRegistrations() { } private boolean isNotReadyToRegister() { - if (!validatorRegistrationPropertiesProvider.isReadyToProvideFeeRecipient()) { + if (!feeRecipientProvider.isReadyToProvideFeeRecipient()) { LOG.debug("Not ready to register validator(s)."); return true; } @@ -201,8 +201,7 @@ private Optional> createSignedValidatorR return Optional.empty(); } - final Optional maybeFeeRecipient = - validatorRegistrationPropertiesProvider.getFeeRecipient(publicKey); + final Optional maybeFeeRecipient = feeRecipientProvider.getFeeRecipient(publicKey); if (maybeFeeRecipient.isEmpty()) { LOG.debug( diff --git a/validator/client/src/test/java/tech/pegasys/teku/validator/client/BeaconProposerPreparerTest.java b/validator/client/src/test/java/tech/pegasys/teku/validator/client/BeaconProposerPreparerTest.java index 181805491e8..a3cda76bdbb 100644 --- a/validator/client/src/test/java/tech/pegasys/teku/validator/client/BeaconProposerPreparerTest.java +++ b/validator/client/src/test/java/tech/pegasys/teku/validator/client/BeaconProposerPreparerTest.java @@ -59,13 +59,9 @@ public class BeaconProposerPreparerTest { private final ProposerConfigProvider proposerConfigProvider = mock(ProposerConfigProvider.class); private BeaconProposerPreparer beaconProposerPreparer; private Eth1Address defaultFeeRecipient; - private UInt64 defaultGasLimit; private Eth1Address defaultFeeRecipientConfig; - private UInt64 defaultGasLimitConfig; private Eth1Address validator1FeeRecipientConfig; - private UInt64 validator1GasLimitConfig; - private Spec spec; private Validator validator1; @@ -102,22 +98,15 @@ void setUp(SpecContext specContext) { validator3.getPublicKey(), validator3Index); defaultFeeRecipient = specContext.getDataStructureUtil().randomEth1Address(); - defaultGasLimit = specContext.getDataStructureUtil().randomUInt64(); defaultFeeRecipientConfig = specContext.getDataStructureUtil().randomEth1Address(); - defaultGasLimitConfig = specContext.getDataStructureUtil().randomUInt64(); validator1FeeRecipientConfig = specContext.getDataStructureUtil().randomEth1Address(); - validator1GasLimitConfig = specContext.getDataStructureUtil().randomUInt64(); ProposerConfig proposerConfig = new ProposerConfig( Map.of( validator1.getPublicKey().toBytesCompressed(), - new ProposerConfig.Config( - validator1FeeRecipientConfig, - new ProposerConfig.BuilderConfig(true, validator1GasLimitConfig, null))), - new ProposerConfig.Config( - defaultFeeRecipientConfig, - new ProposerConfig.BuilderConfig(true, defaultGasLimitConfig, null))); + new ProposerConfig.Config(validator1FeeRecipientConfig, null)), + new ProposerConfig.Config(defaultFeeRecipientConfig, null)); beaconProposerPreparer = new BeaconProposerPreparer( @@ -125,7 +114,6 @@ void setUp(SpecContext specContext) { validatorIndexProvider, proposerConfigProvider, Optional.of(defaultFeeRecipient), - defaultGasLimit, spec); slotsPerEpoch = spec.getSlotsPerEpoch(UInt64.ZERO); @@ -178,51 +166,24 @@ void getFeeRecipient_shouldReturnEmptyIfValidatorIndexProviderMissing() { Optional.empty(), proposerConfigProvider, Optional.of(defaultFeeRecipient), - defaultGasLimit, spec, Optional.empty()); assertThat(beaconProposerPreparer.getFeeRecipient(validator1.getPublicKey())).isEmpty(); } - @TestTemplate - void getGasLimit_shouldReturnEmptyIfValidatorIndexProviderMissing() { - beaconProposerPreparer = - new BeaconProposerPreparer( - validatorApiChannel, - Optional.empty(), - proposerConfigProvider, - Optional.of(defaultFeeRecipient), - defaultGasLimit, - spec, - Optional.empty()); - - assertThat(beaconProposerPreparer.getGasLimit(validator1.getPublicKey())).isEmpty(); - } - @TestTemplate void getFeeRecipient_shouldReturnDefaultFeeRecipientWhenProposerConfigMissing() { assertThat(beaconProposerPreparer.getFeeRecipient(validator1.getPublicKey())) .contains(defaultFeeRecipient); } - @TestTemplate - void getGasLimit_shouldReturnDefaultFeeRecipientWhenProposerConfigMissing() { - assertThat(beaconProposerPreparer.getGasLimit(validator1.getPublicKey())) - .contains(defaultGasLimit); - } - @TestTemplate void getFeeRecipient_shouldReturnEmptyIfValidatorIndexProviderMissingPubkey() { assertThat(beaconProposerPreparer.getFeeRecipient(dataStructureUtil.randomPublicKey())) .isEmpty(); } - @TestTemplate - void getGasLimit_shouldReturnEmptyIfValidatorIndexProviderMissingPubkey() { - assertThat(beaconProposerPreparer.getGasLimit(dataStructureUtil.randomPublicKey())).isEmpty(); - } - @TestTemplate void getFeeRecipient_shouldReturnConfigurationFileValueFirst(@TempDir final Path tempDir) throws IOException { @@ -237,20 +198,6 @@ void getFeeRecipient_shouldReturnConfigurationFileValueFirst(@TempDir final Path .contains(validator1FeeRecipientConfig); } - @TestTemplate - void getGasLimit_shouldReturnConfigurationFileValueFirst(@TempDir final Path tempDir) - throws IOException { - proposerWithRuntimeConfiguration( - tempDir, - validator1.getPublicKey(), - dataStructureUtil.randomEth1Address(), - dataStructureUtil.randomUInt64()); - beaconProposerPreparer.onSlot(UInt64.ONE); - - assertThat(beaconProposerPreparer.getGasLimit(validator1.getPublicKey())) - .contains(validator1GasLimitConfig); - } - @TestTemplate void deleteFeeRecipient_shouldReturnFalseIfConfigurationSetsAddress() { beaconProposerPreparer.onSlot(UInt64.ONE); @@ -288,17 +235,6 @@ void getFeeRecipient_shouldReturnRuntimeConfigIfNotPresentInConfigurationFile( assertThat(beaconProposerPreparer.getFeeRecipient(validator2.getPublicKey())).contains(address); } - @TestTemplate - void getGasLimit_shouldReturnRuntimeConfigIfNotPresentInConfigurationFile( - @TempDir final Path tempDir) throws IOException { - final UInt64 gasLimit = dataStructureUtil.randomUInt64(); - proposerWithRuntimeConfiguration( - tempDir, validator2.getPublicKey(), dataStructureUtil.randomEth1Address(), gasLimit); - beaconProposerPreparer.onSlot(UInt64.ONE); - - assertThat(beaconProposerPreparer.getGasLimit(validator2.getPublicKey())).contains(gasLimit); - } - @TestTemplate void getFeeRecipient_shouldReturnConfigFileDefaultIfNotPresentInConfigOrRuntime() { beaconProposerPreparer.onSlot(UInt64.ONE); @@ -306,13 +242,6 @@ void getFeeRecipient_shouldReturnConfigFileDefaultIfNotPresentInConfigOrRuntime( .contains(defaultFeeRecipientConfig); } - @TestTemplate - void getGasLimit_shouldReturnConfigFileDefaultIfNotPresentInConfigOrRuntime() { - beaconProposerPreparer.onSlot(UInt64.ONE); - assertThat(beaconProposerPreparer.getGasLimit(validator2.getPublicKey())) - .contains(defaultGasLimitConfig); - } - @TestTemplate void setFeeRecipient_shouldNotAcceptForConfiguredPubkey() { beaconProposerPreparer.onSlot(UInt64.ONE); @@ -323,14 +252,6 @@ void setFeeRecipient_shouldNotAcceptForConfiguredPubkey() { .isInstanceOf(SetFeeRecipientException.class); } - @TestTemplate - void setGasLimit_shouldNotAcceptForConfiguredPubkey() { - beaconProposerPreparer.onSlot(UInt64.ONE); - assertThatThrownBy( - () -> beaconProposerPreparer.setGasLimit(validator1.getPublicKey(), defaultGasLimit)) - .isInstanceOf(SetGasLimitException.class); - } - @TestTemplate void setFeeRecipient_shouldUpdateRuntimeFeeRecipient(@TempDir final Path tempDir) throws IOException, SetFeeRecipientException { @@ -346,21 +267,6 @@ void setFeeRecipient_shouldUpdateRuntimeFeeRecipient(@TempDir final Path tempDir assertThat(beaconProposerPreparer.getFeeRecipient(validator2.getPublicKey())).contains(address); } - @TestTemplate - void setGasLimit_shouldUpdateRuntimeFeeRecipient(@TempDir final Path tempDir) - throws IOException, SetFeeRecipientException { - final UInt64 gasLimit = dataStructureUtil.randomUInt64(); - proposerWithRuntimeConfiguration( - tempDir, - validator2.getPublicKey(), - dataStructureUtil.randomEth1Address(), - dataStructureUtil.randomUInt64()); - beaconProposerPreparer.onSlot(UInt64.ONE); - - beaconProposerPreparer.setGasLimit(validator2.getPublicKey(), gasLimit); - assertThat(beaconProposerPreparer.getGasLimit(validator2.getPublicKey())).contains(gasLimit); - } - @TestTemplate void setFeeRecipient_shouldNotAllowSettingToZero() { assertThatThrownBy( @@ -444,7 +350,7 @@ private void proposerWithRuntimeConfiguration( final String data = String.format( "{\"%s\":{\"fee_recipient\":\"%s\",\"gas_limit\":\"%s\"}}", - pubkey, eth1Address, gasLimit.toString()); + pubkey, eth1Address, gasLimit); Files.write(recipients, data.getBytes(StandardCharsets.UTF_8)); beaconProposerPreparer = new BeaconProposerPreparer( @@ -452,7 +358,6 @@ private void proposerWithRuntimeConfiguration( Optional.of(validatorIndexProvider), proposerConfigProvider, Optional.of(defaultFeeRecipient), - defaultGasLimit, spec, Optional.of(tempDir.resolve("recipients"))); } 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 be413c47698..71ae61fec95 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 @@ -58,8 +58,7 @@ class ValidatorRegistratorTest { private final ProposerConfigProvider proposerConfigProvider = mock(ProposerConfigProvider.class); private final ProposerConfig proposerConfig = mock(ProposerConfig.class); private final ValidatorConfig validatorConfig = mock(ValidatorConfig.class); - private final ValidatorRegistrationPropertiesProvider validatorRegistrationPropertiesProvider = - mock(ValidatorRegistrationPropertiesProvider.class); + private final FeeRecipientProvider feeRecipientProvider = mock(FeeRecipientProvider.class); private final ValidatorRegistrationBatchSender validatorRegistrationBatchSender = mock(ValidatorRegistrationBatchSender.class); private final TimeProvider stubTimeProvider = StubTimeProvider.withTimeInSeconds(12); @@ -95,7 +94,7 @@ void setUp(SpecContext specContext) { ownedValidators, proposerConfigProvider, validatorConfig, - validatorRegistrationPropertiesProvider, + feeRecipientProvider, validatorRegistrationBatchSender); when(validatorRegistrationBatchSender.sendInBatches(any())).thenReturn(SafeFuture.COMPLETE); @@ -105,9 +104,8 @@ void setUp(SpecContext specContext) { when(proposerConfig.isBuilderEnabledForPubKey(any())).thenReturn(Optional.of(true)); when(proposerConfig.getBuilderGasLimitForPubKey(any())).thenReturn(Optional.of(gasLimit)); - when(validatorRegistrationPropertiesProvider.isReadyToProvideFeeRecipient()).thenReturn(true); - when(validatorRegistrationPropertiesProvider.getFeeRecipient(any())) - .thenReturn(Optional.of(eth1Address)); + when(feeRecipientProvider.isReadyToProvideFeeRecipient()).thenReturn(true); + when(feeRecipientProvider.getFeeRecipient(any())).thenReturn(Optional.of(eth1Address)); // random signature for all signings doAnswer(invocation -> SafeFuture.completedFuture(dataStructureUtil.randomSignature())) @@ -117,7 +115,7 @@ void setUp(SpecContext specContext) { @TestTemplate void doesNotRegisterValidators_ifNotReady() { - when(validatorRegistrationPropertiesProvider.isReadyToProvideFeeRecipient()).thenReturn(false); + when(feeRecipientProvider.isReadyToProvideFeeRecipient()).thenReturn(false); runRegistrationFlowForSlot(UInt64.ONE); @@ -305,7 +303,7 @@ void doesNotUseCache_ifRegistrationsNeedUpdating() { final UInt64 otherTimestamp = dataStructureUtil.randomUInt64(); // fee recipient changed for validator2 - when(validatorRegistrationPropertiesProvider.getFeeRecipient(validator2.getPublicKey())) + when(feeRecipientProvider.getFeeRecipient(validator2.getPublicKey())) .thenReturn(Optional.of(otherEth1Address)); // gas limit changed for validator3 @@ -367,7 +365,7 @@ void doesNotUseCache_ifRegistrationsNeedUpdating() { @TestTemplate void doesNotRegisterNewlyAddedValidators_ifNotReady() { - when(validatorRegistrationPropertiesProvider.isReadyToProvideFeeRecipient()).thenReturn(false); + when(feeRecipientProvider.isReadyToProvideFeeRecipient()).thenReturn(false); validatorRegistrator.onValidatorsAdded(); @@ -460,7 +458,7 @@ void skipsValidatorRegistrationIfFeeRecipientNotSpecified() { setActiveValidators(validator1, validator2); // no fee recipient provided for validator2 - when(validatorRegistrationPropertiesProvider.getFeeRecipient(validator2.getPublicKey())) + when(feeRecipientProvider.getFeeRecipient(validator2.getPublicKey())) .thenReturn(Optional.empty()); runRegistrationFlowForSlot(UInt64.ZERO);