diff --git a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/ExecutionEngineClient.java b/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/ExecutionEngineClient.java index 0277f3de9c6..19d8d8a3d97 100644 --- a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/ExecutionEngineClient.java +++ b/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/ExecutionEngineClient.java @@ -30,7 +30,6 @@ import tech.pegasys.teku.ethereum.executionclient.schema.PayloadAttributesV1; import tech.pegasys.teku.ethereum.executionclient.schema.PayloadAttributesV2; import tech.pegasys.teku.ethereum.executionclient.schema.PayloadAttributesV3; -import tech.pegasys.teku.ethereum.executionclient.schema.PayloadAttributesV4; import tech.pegasys.teku.ethereum.executionclient.schema.PayloadStatusV1; import tech.pegasys.teku.ethereum.executionclient.schema.Response; import tech.pegasys.teku.infrastructure.async.SafeFuture; @@ -77,9 +76,6 @@ SafeFuture> forkChoiceUpdatedV2( SafeFuture> forkChoiceUpdatedV3( ForkChoiceStateV1 forkChoiceState, Optional payloadAttributes); - SafeFuture> forkChoiceUpdatedV4( - ForkChoiceStateV1 forkChoiceState, Optional payloadAttributes); - SafeFuture>> exchangeCapabilities(List capabilities); SafeFuture>> getClientVersionV1(ClientVersionV1 clientVersion); diff --git a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/ThrottlingExecutionEngineClient.java b/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/ThrottlingExecutionEngineClient.java index 50e1a969a2e..646a513c8dc 100644 --- a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/ThrottlingExecutionEngineClient.java +++ b/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/ThrottlingExecutionEngineClient.java @@ -31,7 +31,6 @@ import tech.pegasys.teku.ethereum.executionclient.schema.PayloadAttributesV1; import tech.pegasys.teku.ethereum.executionclient.schema.PayloadAttributesV2; import tech.pegasys.teku.ethereum.executionclient.schema.PayloadAttributesV3; -import tech.pegasys.teku.ethereum.executionclient.schema.PayloadAttributesV4; import tech.pegasys.teku.ethereum.executionclient.schema.PayloadStatusV1; import tech.pegasys.teku.ethereum.executionclient.schema.Response; import tech.pegasys.teku.infrastructure.async.SafeFuture; @@ -145,14 +144,6 @@ public SafeFuture> forkChoiceUpdatedV3( () -> delegate.forkChoiceUpdatedV3(forkChoiceState, payloadAttributes)); } - @Override - public SafeFuture> forkChoiceUpdatedV4( - final ForkChoiceStateV1 forkChoiceState, - final Optional payloadAttributes) { - return taskQueue.queueTask( - () -> delegate.forkChoiceUpdatedV4(forkChoiceState, payloadAttributes)); - } - @Override public SafeFuture>> exchangeCapabilities(final List capabilities) { return taskQueue.queueTask(() -> delegate.exchangeCapabilities(capabilities)); diff --git a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/methods/EngineForkChoiceUpdatedV4.java b/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/methods/EngineForkChoiceUpdatedV4.java deleted file mode 100644 index d00676e03dd..00000000000 --- a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/methods/EngineForkChoiceUpdatedV4.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright Consensys Software Inc., 2023 - * - * 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.ethereum.executionclient.methods; - -import java.util.Optional; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import tech.pegasys.teku.ethereum.executionclient.ExecutionEngineClient; -import tech.pegasys.teku.ethereum.executionclient.response.ResponseUnwrapper; -import tech.pegasys.teku.ethereum.executionclient.schema.ForkChoiceStateV1; -import tech.pegasys.teku.ethereum.executionclient.schema.ForkChoiceUpdatedResult; -import tech.pegasys.teku.ethereum.executionclient.schema.PayloadAttributesV4; -import tech.pegasys.teku.infrastructure.async.SafeFuture; -import tech.pegasys.teku.spec.executionlayer.ForkChoiceState; -import tech.pegasys.teku.spec.executionlayer.PayloadBuildingAttributes; - -public class EngineForkChoiceUpdatedV4 - extends AbstractEngineJsonRpcMethod< - tech.pegasys.teku.spec.executionlayer.ForkChoiceUpdatedResult> { - - private static final Logger LOG = LogManager.getLogger(); - - public EngineForkChoiceUpdatedV4(final ExecutionEngineClient executionEngineClient) { - super(executionEngineClient); - } - - @Override - public String getName() { - return EngineApiMethod.ENGINE_FORK_CHOICE_UPDATED.getName(); - } - - @Override - public int getVersion() { - return 4; - } - - @Override - public SafeFuture execute( - final JsonRpcRequestParams params) { - final ForkChoiceState forkChoiceState = params.getRequiredParameter(0, ForkChoiceState.class); - final Optional payloadBuildingAttributes = - params.getOptionalParameter(1, PayloadBuildingAttributes.class); - - LOG.trace( - "Calling {}(forkChoiceState={}, payloadAttributes={})", - getVersionedName(), - forkChoiceState, - payloadBuildingAttributes); - - final Optional maybePayloadAttributes = - payloadBuildingAttributes.flatMap( - attributes -> - PayloadAttributesV4.fromInternalPayloadBuildingAttributesV4( - payloadBuildingAttributes)); - - return executionEngineClient - .forkChoiceUpdatedV4( - ForkChoiceStateV1.fromInternalForkChoiceState(forkChoiceState), maybePayloadAttributes) - .thenApply(ResponseUnwrapper::unwrapExecutionClientResponseOrThrow) - .thenApply(ForkChoiceUpdatedResult::asInternalExecutionPayload) - .thenPeek( - forkChoiceUpdatedResult -> - LOG.trace( - "Response {}(forkChoiceState={}, payloadAttributes={}) -> {}", - getVersionedName(), - forkChoiceState, - payloadBuildingAttributes, - forkChoiceUpdatedResult)); - } -} diff --git a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/metrics/MetricRecordingExecutionEngineClient.java b/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/metrics/MetricRecordingExecutionEngineClient.java index ec4b9249a08..62d3a4def02 100644 --- a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/metrics/MetricRecordingExecutionEngineClient.java +++ b/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/metrics/MetricRecordingExecutionEngineClient.java @@ -33,7 +33,6 @@ import tech.pegasys.teku.ethereum.executionclient.schema.PayloadAttributesV1; import tech.pegasys.teku.ethereum.executionclient.schema.PayloadAttributesV2; import tech.pegasys.teku.ethereum.executionclient.schema.PayloadAttributesV3; -import tech.pegasys.teku.ethereum.executionclient.schema.PayloadAttributesV4; import tech.pegasys.teku.ethereum.executionclient.schema.PayloadStatusV1; import tech.pegasys.teku.ethereum.executionclient.schema.Response; import tech.pegasys.teku.infrastructure.async.SafeFuture; @@ -60,11 +59,8 @@ public class MetricRecordingExecutionEngineClient extends MetricRecordingAbstrac public static final String FORKCHOICE_UPDATED_WITH_ATTRIBUTES_V2_METHOD = "forkchoice_updated_with_attributesV2"; public static final String FORKCHOICE_UPDATED_V3_METHOD = "forkchoice_updatedV3"; - public static final String FORKCHOICE_UPDATED_V4_METHOD = "forkchoice_updatedV4"; public static final String FORKCHOICE_UPDATED_WITH_ATTRIBUTES_V3_METHOD = "forkchoice_updated_with_attributesV3"; - public static final String FORKCHOICE_UPDATED_WITH_ATTRIBUTES_V4_METHOD = - "forkchoice_updated_with_attributesV4"; public static final String GET_PAYLOAD_V3_METHOD = "get_payloadV3"; public static final String GET_PAYLOAD_V4_METHOD = "get_payloadV4"; public static final String NEW_PAYLOAD_V3_METHOD = "new_payloadV3"; @@ -189,17 +185,6 @@ public SafeFuture> forkChoiceUpdatedV3( : FORKCHOICE_UPDATED_V3_METHOD); } - @Override - public SafeFuture> forkChoiceUpdatedV4( - final ForkChoiceStateV1 forkChoiceState, - final Optional payloadAttributes) { - return countRequest( - () -> delegate.forkChoiceUpdatedV4(forkChoiceState, payloadAttributes), - payloadAttributes.isPresent() - ? FORKCHOICE_UPDATED_WITH_ATTRIBUTES_V4_METHOD - : FORKCHOICE_UPDATED_V4_METHOD); - } - @Override public SafeFuture>> exchangeCapabilities(final List capabilities) { return countRequest( diff --git a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/PayloadAttributesV4.java b/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/PayloadAttributesV4.java deleted file mode 100644 index e3ed4caa59f..00000000000 --- a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/PayloadAttributesV4.java +++ /dev/null @@ -1,115 +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.ethereum.executionclient.schema; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.google.common.base.MoreObjects; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.ethereum.executionclient.serialization.UInt64AsHexDeserializer; -import tech.pegasys.teku.ethereum.executionclient.serialization.UInt64AsHexSerializer; -import tech.pegasys.teku.infrastructure.bytes.Bytes20; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.executionlayer.PayloadBuildingAttributes; - -public class PayloadAttributesV4 extends PayloadAttributesV3 { - - @JsonSerialize(using = UInt64AsHexSerializer.class) - @JsonDeserialize(using = UInt64AsHexDeserializer.class) - public final UInt64 targetBlobCount; - - @JsonSerialize(using = UInt64AsHexSerializer.class) - @JsonDeserialize(using = UInt64AsHexDeserializer.class) - public final UInt64 maximumBlobCount; - - public PayloadAttributesV4( - final @JsonProperty("timestamp") UInt64 timestamp, - final @JsonProperty("prevRandao") Bytes32 prevRandao, - final @JsonProperty("suggestedFeeRecipient") Bytes20 suggestedFeeRecipient, - final @JsonProperty("withdrawals") List withdrawals, - final @JsonProperty("parentBeaconBlockRoot") Bytes32 parentBeaconBlockRoot, - final @JsonProperty("targetBlobCount") UInt64 targetBlobCount, - final @JsonProperty("maximumBlobCount") UInt64 maximumBlobCount) { - super(timestamp, prevRandao, suggestedFeeRecipient, withdrawals, parentBeaconBlockRoot); - - checkNotNull(targetBlobCount, "targetBlobCount"); - checkNotNull(maximumBlobCount, "maximumBlobCount"); - this.targetBlobCount = targetBlobCount; - this.maximumBlobCount = maximumBlobCount; - } - - public static Optional fromInternalPayloadBuildingAttributesV4( - final Optional payloadBuildingAttributes) { - return payloadBuildingAttributes.map( - payloadAttributes -> - new PayloadAttributesV4( - payloadAttributes.getTimestamp(), - payloadAttributes.getPrevRandao(), - payloadAttributes.getFeeRecipient(), - getWithdrawals(payloadAttributes), - payloadAttributes.getParentBeaconBlockRoot(), - payloadAttributes - .getTargetBlobCount() - .orElseThrow( - () -> - new IllegalArgumentException( - "targetBlobCount is required for PayloadAttributesV4")), - payloadAttributes - .getMaximumBlobCount() - .orElseThrow( - () -> - new IllegalArgumentException( - "maximumBlobCount is required for PayloadAttributesV4")))); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - if (!super.equals(o)) { - return false; - } - final PayloadAttributesV4 that = (PayloadAttributesV4) o; - return Objects.equals(targetBlobCount, that.targetBlobCount) - && Objects.equals(maximumBlobCount, that.maximumBlobCount); - } - - @Override - public int hashCode() { - return Objects.hash(super.hashCode(), targetBlobCount, maximumBlobCount); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("timestamp", timestamp) - .add("prevRandao", prevRandao) - .add("suggestedFeeRecipient", suggestedFeeRecipient) - .add("withdrawals", withdrawals) - .add("parentBeaconBlockRoot", parentBeaconBlockRoot) - .add("targetBlobCount", targetBlobCount) - .add("maximumBlobCount", maximumBlobCount) - .toString(); - } -} diff --git a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/web3j/Web3JExecutionEngineClient.java b/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/web3j/Web3JExecutionEngineClient.java index d029d8e4dfc..6eed83dd565 100644 --- a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/web3j/Web3JExecutionEngineClient.java +++ b/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/web3j/Web3JExecutionEngineClient.java @@ -41,7 +41,6 @@ import tech.pegasys.teku.ethereum.executionclient.schema.PayloadAttributesV1; import tech.pegasys.teku.ethereum.executionclient.schema.PayloadAttributesV2; import tech.pegasys.teku.ethereum.executionclient.schema.PayloadAttributesV3; -import tech.pegasys.teku.ethereum.executionclient.schema.PayloadAttributesV4; import tech.pegasys.teku.ethereum.executionclient.schema.PayloadStatusV1; import tech.pegasys.teku.ethereum.executionclient.schema.Response; import tech.pegasys.teku.infrastructure.async.SafeFuture; @@ -239,19 +238,6 @@ public SafeFuture> forkChoiceUpdatedV3( return web3JClient.doRequest(web3jRequest, EL_ENGINE_BLOCK_EXECUTION_TIMEOUT); } - @Override - public SafeFuture> forkChoiceUpdatedV4( - final ForkChoiceStateV1 forkChoiceState, - final Optional payloadAttributes) { - final Request web3jRequest = - new Request<>( - "engine_forkchoiceUpdatedV4", - list(forkChoiceState, payloadAttributes.orElse(null)), - web3JClient.getWeb3jService(), - ForkChoiceUpdatedResultWeb3jResponse.class); - return web3JClient.doRequest(web3jRequest, EL_ENGINE_BLOCK_EXECUTION_TIMEOUT); - } - @Override public SafeFuture>> exchangeCapabilities(final List capabilities) { final Request web3jRequest = diff --git a/ethereum/executionclient/src/test/java/tech/pegasys/teku/ethereum/executionclient/methods/EngineForkChoiceUpdatedV4Test.java b/ethereum/executionclient/src/test/java/tech/pegasys/teku/ethereum/executionclient/methods/EngineForkChoiceUpdatedV4Test.java deleted file mode 100644 index e666b69bb31..00000000000 --- a/ethereum/executionclient/src/test/java/tech/pegasys/teku/ethereum/executionclient/methods/EngineForkChoiceUpdatedV4Test.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright Consensys Software Inc., 2023 - * - * 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.ethereum.executionclient.methods; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.when; - -import java.util.Optional; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import tech.pegasys.teku.ethereum.executionclient.ExecutionEngineClient; -import tech.pegasys.teku.ethereum.executionclient.response.InvalidRemoteResponseException; -import tech.pegasys.teku.ethereum.executionclient.schema.ForkChoiceStateV1; -import tech.pegasys.teku.ethereum.executionclient.schema.ForkChoiceUpdatedResult; -import tech.pegasys.teku.ethereum.executionclient.schema.PayloadAttributesV4; -import tech.pegasys.teku.ethereum.executionclient.schema.PayloadStatusV1; -import tech.pegasys.teku.ethereum.executionclient.schema.Response; -import tech.pegasys.teku.infrastructure.async.SafeFuture; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.TestSpecFactory; -import tech.pegasys.teku.spec.executionlayer.ExecutionPayloadStatus; -import tech.pegasys.teku.spec.executionlayer.ForkChoiceState; -import tech.pegasys.teku.spec.executionlayer.PayloadBuildingAttributes; -import tech.pegasys.teku.spec.util.DataStructureUtil; - -class EngineForkChoiceUpdatedV4Test { - - private final Spec spec = TestSpecFactory.createMinimalDeneb(); - private final DataStructureUtil dataStructureUtil = new DataStructureUtil(spec); - private final ExecutionEngineClient executionEngineClient = mock(ExecutionEngineClient.class); - private EngineForkChoiceUpdatedV4 jsonRpcMethod; - - @BeforeEach - public void setUp() { - jsonRpcMethod = new EngineForkChoiceUpdatedV4(executionEngineClient); - } - - @Test - public void shouldReturnExpectedNameAndVersion() { - assertThat(jsonRpcMethod.getName()).isEqualTo("engine_forkchoiceUpdated"); - assertThat(jsonRpcMethod.getVersion()).isEqualTo(4); - assertThat(jsonRpcMethod.getVersionedName()).isEqualTo("engine_forkchoiceUpdatedV4"); - } - - @Test - public void forkChoiceStateParamIsRequired() { - final JsonRpcRequestParams params = new JsonRpcRequestParams.Builder().build(); - - assertThatThrownBy(() -> jsonRpcMethod.execute(params)) - .isInstanceOf(IllegalArgumentException.class) - .hasMessage("Missing required parameter at index 0"); - - verifyNoInteractions(executionEngineClient); - } - - @Test - public void payloadBuildingAttributesParamIsOptional() { - final ForkChoiceState forkChoiceState = dataStructureUtil.randomForkChoiceState(false); - - when(executionEngineClient.forkChoiceUpdatedV4(any(), eq(Optional.empty()))) - .thenReturn(dummySuccessfulResponse()); - - final JsonRpcRequestParams params = - new JsonRpcRequestParams.Builder().add(forkChoiceState).build(); - - assertThat(jsonRpcMethod.execute(params)).isCompleted(); - - verify(executionEngineClient).forkChoiceUpdatedV4(any(), eq(Optional.empty())); - } - - @Test - public void shouldReturnFailedFutureWithMessageWhenEngineClientRequestFails() { - final ForkChoiceState forkChoiceState = dataStructureUtil.randomForkChoiceState(false); - final String errorResponseFromClient = "error!"; - - when(executionEngineClient.forkChoiceUpdatedV4(any(), any())) - .thenReturn(dummyFailedResponse(errorResponseFromClient)); - - final JsonRpcRequestParams params = - new JsonRpcRequestParams.Builder().add(forkChoiceState).build(); - - assertThat(jsonRpcMethod.execute(params)) - .failsWithin(1, TimeUnit.SECONDS) - .withThrowableOfType(ExecutionException.class) - .withRootCauseInstanceOf(InvalidRemoteResponseException.class) - .withMessageContaining( - "Invalid remote response from the execution client: %s", errorResponseFromClient); - } - - @Test - public void shouldCallForkChoiceUpdateV4WithPayloadAttributesV4WhenInElectra() { - final ForkChoiceState forkChoiceState = dataStructureUtil.randomForkChoiceState(false); - final PayloadBuildingAttributes payloadBuildingAttributes = - dataStructureUtil.randomPayloadBuildingAttributes(false); - final ForkChoiceStateV1 forkChoiceStateV1 = - ForkChoiceStateV1.fromInternalForkChoiceState(forkChoiceState); - final Optional payloadAttributesV4 = - PayloadAttributesV4.fromInternalPayloadBuildingAttributesV4( - Optional.of(payloadBuildingAttributes)); - - jsonRpcMethod = new EngineForkChoiceUpdatedV4(executionEngineClient); - - when(executionEngineClient.forkChoiceUpdatedV4(forkChoiceStateV1, payloadAttributesV4)) - .thenReturn(dummySuccessfulResponse()); - - final JsonRpcRequestParams params = - new JsonRpcRequestParams.Builder() - .add(forkChoiceState) - .add(payloadBuildingAttributes) - .build(); - - assertThat(jsonRpcMethod.execute(params)).isCompleted(); - - verify(executionEngineClient).forkChoiceUpdatedV4(forkChoiceStateV1, payloadAttributesV4); - } - - private SafeFuture> dummySuccessfulResponse() { - return SafeFuture.completedFuture( - new Response<>( - new ForkChoiceUpdatedResult( - new PayloadStatusV1( - ExecutionPayloadStatus.ACCEPTED, dataStructureUtil.randomBytes32(), ""), - dataStructureUtil.randomBytes8()))); - } - - private SafeFuture> dummyFailedResponse( - final String errorMessage) { - return SafeFuture.completedFuture(Response.withErrorMessage(errorMessage)); - } -} diff --git a/ethereum/executionclient/src/test/java/tech/pegasys/teku/ethereum/executionclient/schema/PayloadAttributesV4Test.java b/ethereum/executionclient/src/test/java/tech/pegasys/teku/ethereum/executionclient/schema/PayloadAttributesV4Test.java deleted file mode 100644 index a02d7cd6308..00000000000 --- a/ethereum/executionclient/src/test/java/tech/pegasys/teku/ethereum/executionclient/schema/PayloadAttributesV4Test.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright Consensys Software Inc., 2024 - * - * 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.ethereum.executionclient.schema; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; - -import java.util.Optional; -import org.junit.jupiter.api.Test; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.TestSpecFactory; -import tech.pegasys.teku.spec.executionlayer.PayloadBuildingAttributes; -import tech.pegasys.teku.spec.util.DataStructureUtil; - -class PayloadAttributesV4Test { - - private final Spec spec = TestSpecFactory.createMinimalElectra(); - private final DataStructureUtil dataStructureUtil = new DataStructureUtil(spec); - - @Test - public void buildFromInternalPayload_RequiresTargetBlobCount() { - final PayloadBuildingAttributes pbaMissingTargetBlobCount = - new PayloadBuildingAttributes( - dataStructureUtil.randomUInt64(), - dataStructureUtil.randomUInt64(), - dataStructureUtil.randomUInt64(), - dataStructureUtil.randomBytes32(), - dataStructureUtil.randomEth1Address(), - Optional.empty(), - Optional.empty(), - dataStructureUtil.randomBytes32(), - Optional.empty(), - Optional.of(dataStructureUtil.randomUInt64())); - - assertThrows( - IllegalArgumentException.class, - () -> - PayloadAttributesV4.fromInternalPayloadBuildingAttributesV4( - Optional.of(pbaMissingTargetBlobCount))); - } - - @Test - public void buildFromInternalPayload_RequiresMaximumBlobCount() { - final PayloadBuildingAttributes pbaMissingMaximumBlobCount = - new PayloadBuildingAttributes( - dataStructureUtil.randomUInt64(), - dataStructureUtil.randomUInt64(), - dataStructureUtil.randomUInt64(), - dataStructureUtil.randomBytes32(), - dataStructureUtil.randomEth1Address(), - Optional.empty(), - Optional.empty(), - dataStructureUtil.randomBytes32(), - Optional.of(dataStructureUtil.randomUInt64()), - Optional.empty()); - - assertThrows( - IllegalArgumentException.class, - () -> - PayloadAttributesV4.fromInternalPayloadBuildingAttributesV4( - Optional.of(pbaMissingMaximumBlobCount))); - } - - @Test - public void buildFromInternalPayload_HasCorrectValues() { - final PayloadBuildingAttributes payloadBuildingAttributes = - dataStructureUtil.randomPayloadBuildingAttributes(false); - - final PayloadAttributesV4 payloadAttributesV4 = - PayloadAttributesV4.fromInternalPayloadBuildingAttributesV4( - Optional.of(payloadBuildingAttributes)) - .orElseThrow(); - - assertThat(payloadBuildingAttributes.getTimestamp()).isEqualTo(payloadAttributesV4.timestamp); - assertThat(payloadBuildingAttributes.getPrevRandao()).isEqualTo(payloadAttributesV4.prevRandao); - assertThat(payloadBuildingAttributes.getFeeRecipient()) - .isEqualTo(payloadAttributesV4.suggestedFeeRecipient); - assertThat(payloadBuildingAttributes.getWithdrawals()) - .hasValueSatisfying( - withdrawals -> - assertEquals(withdrawals.size(), payloadAttributesV4.withdrawals.size())); - assertThat(payloadBuildingAttributes.getParentBeaconBlockRoot()) - .isEqualTo(payloadAttributesV4.parentBeaconBlockRoot); - assertThat(payloadBuildingAttributes.getTargetBlobCount()) - .hasValue(payloadAttributesV4.targetBlobCount); - assertThat(payloadBuildingAttributes.getMaximumBlobCount()) - .hasValue(payloadAttributesV4.maximumBlobCount); - } -} diff --git a/ethereum/executionlayer/src/main/java/tech/pegasys/teku/ethereum/executionlayer/MilestoneBasedEngineJsonRpcMethodsResolver.java b/ethereum/executionlayer/src/main/java/tech/pegasys/teku/ethereum/executionlayer/MilestoneBasedEngineJsonRpcMethodsResolver.java index e441b5eb193..0651980f143 100644 --- a/ethereum/executionlayer/src/main/java/tech/pegasys/teku/ethereum/executionlayer/MilestoneBasedEngineJsonRpcMethodsResolver.java +++ b/ethereum/executionlayer/src/main/java/tech/pegasys/teku/ethereum/executionlayer/MilestoneBasedEngineJsonRpcMethodsResolver.java @@ -31,7 +31,6 @@ import tech.pegasys.teku.ethereum.executionclient.methods.EngineForkChoiceUpdatedV1; import tech.pegasys.teku.ethereum.executionclient.methods.EngineForkChoiceUpdatedV2; import tech.pegasys.teku.ethereum.executionclient.methods.EngineForkChoiceUpdatedV3; -import tech.pegasys.teku.ethereum.executionclient.methods.EngineForkChoiceUpdatedV4; import tech.pegasys.teku.ethereum.executionclient.methods.EngineGetBlobsV1; import tech.pegasys.teku.ethereum.executionclient.methods.EngineGetPayloadV1; import tech.pegasys.teku.ethereum.executionclient.methods.EngineGetPayloadV2; @@ -120,7 +119,7 @@ private Map> electraSupportedMethods() { methods.put(ENGINE_NEW_PAYLOAD, new EngineNewPayloadV4(executionEngineClient)); methods.put(ENGINE_GET_PAYLOAD, new EngineGetPayloadV4(executionEngineClient, spec)); - methods.put(ENGINE_FORK_CHOICE_UPDATED, new EngineForkChoiceUpdatedV4(executionEngineClient)); + methods.put(ENGINE_FORK_CHOICE_UPDATED, new EngineForkChoiceUpdatedV3(executionEngineClient)); methods.put(ENGINE_GET_BLOBS, new EngineGetBlobsV1(executionEngineClient, spec)); return methods; diff --git a/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/ElectraExecutionClientHandlerTest.java b/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/ElectraExecutionClientHandlerTest.java index 122d203b86d..fb1dab85f25 100644 --- a/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/ElectraExecutionClientHandlerTest.java +++ b/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/ElectraExecutionClientHandlerTest.java @@ -31,7 +31,7 @@ import tech.pegasys.teku.ethereum.executionclient.schema.ForkChoiceStateV1; import tech.pegasys.teku.ethereum.executionclient.schema.ForkChoiceUpdatedResult; import tech.pegasys.teku.ethereum.executionclient.schema.GetPayloadV4Response; -import tech.pegasys.teku.ethereum.executionclient.schema.PayloadAttributesV4; +import tech.pegasys.teku.ethereum.executionclient.schema.PayloadAttributesV3; import tech.pegasys.teku.ethereum.executionclient.schema.PayloadStatusV1; import tech.pegasys.teku.ethereum.executionclient.schema.Response; import tech.pegasys.teku.infrastructure.async.SafeFuture; @@ -128,12 +128,11 @@ void engineNewPayload_shouldCallNewPayloadV4() { } @Test - void engineForkChoiceUpdated_shouldCallEngineForkChoiceUpdatedV4() { + void engineForkChoiceUpdated_shouldCallEngineForkChoiceUpdatedV3() { final ExecutionClientHandler handler = getHandler(); final ForkChoiceState forkChoiceState = dataStructureUtil.randomForkChoiceState(false); final ForkChoiceStateV1 forkChoiceStateV1 = ForkChoiceStateV1.fromInternalForkChoiceState(forkChoiceState); - final SpecConfigDeneb specConfigDeneb = SpecConfigDeneb.required(spec.getGenesisSpecConfig()); final PayloadBuildingAttributes attributes = new PayloadBuildingAttributes( dataStructureUtil.randomUInt64(), @@ -143,11 +142,9 @@ void engineForkChoiceUpdated_shouldCallEngineForkChoiceUpdatedV4() { dataStructureUtil.randomEth1Address(), Optional.empty(), Optional.of(List.of()), - dataStructureUtil.randomBytes32(), - Optional.of(UInt64.valueOf(specConfigDeneb.getTargetBlobsPerBlock())), - Optional.of(UInt64.valueOf(specConfigDeneb.getMaxBlobsPerBlock()))); - final Optional payloadAttributes = - PayloadAttributesV4.fromInternalPayloadBuildingAttributesV4(Optional.of(attributes)); + dataStructureUtil.randomBytes32()); + final Optional payloadAttributes = + PayloadAttributesV3.fromInternalPayloadBuildingAttributesV3(Optional.of(attributes)); final ForkChoiceUpdatedResult responseData = new ForkChoiceUpdatedResult( new PayloadStatusV1( @@ -155,11 +152,11 @@ void engineForkChoiceUpdated_shouldCallEngineForkChoiceUpdatedV4() { dataStructureUtil.randomBytes8()); final SafeFuture> dummyResponse = SafeFuture.completedFuture(new Response<>(responseData)); - when(executionEngineClient.forkChoiceUpdatedV4(forkChoiceStateV1, payloadAttributes)) + when(executionEngineClient.forkChoiceUpdatedV3(forkChoiceStateV1, payloadAttributes)) .thenReturn(dummyResponse); final SafeFuture future = handler.engineForkChoiceUpdated(forkChoiceState, Optional.of(attributes)); - verify(executionEngineClient).forkChoiceUpdatedV4(forkChoiceStateV1, payloadAttributes); + verify(executionEngineClient).forkChoiceUpdatedV3(forkChoiceStateV1, payloadAttributes); assertThat(future).isCompletedWithValue(responseData.asInternalExecutionPayload()); } diff --git a/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/MilestoneBasedEngineJsonRpcMethodsResolverTest.java b/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/MilestoneBasedEngineJsonRpcMethodsResolverTest.java index 3e670e7d8be..79d6577e40a 100644 --- a/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/MilestoneBasedEngineJsonRpcMethodsResolverTest.java +++ b/ethereum/executionlayer/src/test/java/tech/pegasys/teku/ethereum/executionlayer/MilestoneBasedEngineJsonRpcMethodsResolverTest.java @@ -34,7 +34,6 @@ import tech.pegasys.teku.ethereum.executionclient.methods.EngineForkChoiceUpdatedV1; import tech.pegasys.teku.ethereum.executionclient.methods.EngineForkChoiceUpdatedV2; import tech.pegasys.teku.ethereum.executionclient.methods.EngineForkChoiceUpdatedV3; -import tech.pegasys.teku.ethereum.executionclient.methods.EngineForkChoiceUpdatedV4; import tech.pegasys.teku.ethereum.executionclient.methods.EngineGetBlobsV1; import tech.pegasys.teku.ethereum.executionclient.methods.EngineGetPayloadV1; import tech.pegasys.teku.ethereum.executionclient.methods.EngineGetPayloadV2; @@ -201,7 +200,7 @@ private static Stream electraMethods() { return Stream.of( arguments(ENGINE_NEW_PAYLOAD, EngineNewPayloadV4.class), arguments(ENGINE_GET_PAYLOAD, EngineGetPayloadV4.class), - arguments(ENGINE_FORK_CHOICE_UPDATED, EngineForkChoiceUpdatedV4.class), + arguments(ENGINE_FORK_CHOICE_UPDATED, EngineForkChoiceUpdatedV3.class), arguments(ENGINE_GET_BLOBS, EngineGetBlobsV1.class)); } @@ -228,8 +227,7 @@ void getsCapabilities() { "engine_getPayloadV3", "engine_forkchoiceUpdatedV3", "engine_newPayloadV4", - "engine_getPayloadV4", - "engine_forkchoiceUpdatedV4"); + "engine_getPayloadV4"); } @Test diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/executionlayer/PayloadBuildingAttributes.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/executionlayer/PayloadBuildingAttributes.java index 7ec469600b8..30a505f1d6e 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/executionlayer/PayloadBuildingAttributes.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/executionlayer/PayloadBuildingAttributes.java @@ -34,8 +34,6 @@ public class PayloadBuildingAttributes { private final Optional validatorRegistration; private final Optional> withdrawals; private final Bytes32 parentBeaconBlockRoot; - private final Optional targetBlobCount; - private final Optional maximumBlobCount; public PayloadBuildingAttributes( final UInt64 proposerIndex, @@ -46,30 +44,6 @@ public PayloadBuildingAttributes( final Optional validatorRegistration, final Optional> withdrawals, final Bytes32 parentBeaconBlockRoot) { - this( - proposerIndex, - proposalSlot, - timestamp, - prevRandao, - feeRecipient, - validatorRegistration, - withdrawals, - parentBeaconBlockRoot, - Optional.empty(), - Optional.empty()); - } - - public PayloadBuildingAttributes( - final UInt64 proposerIndex, - final UInt64 proposalSlot, - final UInt64 timestamp, - final Bytes32 prevRandao, - final Eth1Address feeRecipient, - final Optional validatorRegistration, - final Optional> withdrawals, - final Bytes32 parentBeaconBlockRoot, - final Optional targetBlobCount, - final Optional maximumBlobCount) { this.proposerIndex = proposerIndex; this.proposalSlot = proposalSlot; this.timestamp = timestamp; @@ -78,8 +52,6 @@ public PayloadBuildingAttributes( this.validatorRegistration = validatorRegistration; this.withdrawals = withdrawals; this.parentBeaconBlockRoot = parentBeaconBlockRoot; - this.targetBlobCount = targetBlobCount; - this.maximumBlobCount = maximumBlobCount; } public UInt64 getProposerIndex() { @@ -106,14 +78,6 @@ public Bytes32 getParentBeaconBlockRoot() { return parentBeaconBlockRoot; } - public Optional getTargetBlobCount() { - return targetBlobCount; - } - - public Optional getMaximumBlobCount() { - return maximumBlobCount; - } - public Optional getValidatorRegistration() { return validatorRegistration; } @@ -143,9 +107,7 @@ public boolean equals(final Object o) { && Objects.equals(feeRecipient, that.feeRecipient) && Objects.equals(validatorRegistration, that.validatorRegistration) && Objects.equals(withdrawals, that.withdrawals) - && Objects.equals(parentBeaconBlockRoot, that.parentBeaconBlockRoot) - && Objects.equals(targetBlobCount, that.targetBlobCount) - && Objects.equals(maximumBlobCount, that.maximumBlobCount); + && Objects.equals(parentBeaconBlockRoot, that.parentBeaconBlockRoot); } @Override @@ -158,9 +120,7 @@ public int hashCode() { feeRecipient, validatorRegistration, withdrawals, - parentBeaconBlockRoot, - targetBlobCount, - maximumBlobCount); + parentBeaconBlockRoot); } @Override @@ -174,8 +134,6 @@ public String toString() { .add("validatorRegistration", validatorRegistration) .add("withdrawals", withdrawals) .add("parentBeaconBlockRoot", parentBeaconBlockRoot) - .add("targetBlobCount", targetBlobCount) - .add("maximumBlobCount", maximumBlobCount) .toString(); } } diff --git a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/util/DataStructureUtil.java b/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/util/DataStructureUtil.java index 122fbd9e617..6cea4f93c38 100644 --- a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/util/DataStructureUtil.java +++ b/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/util/DataStructureUtil.java @@ -1823,9 +1823,7 @@ public PayloadBuildingAttributes randomPayloadBuildingAttributes( ? Optional.of(randomSignedValidatorRegistration()) : Optional.empty(), randomWithdrawalList(), - randomBytes32(), - Optional.of(randomUInt64()), - Optional.of(randomUInt64())); + randomBytes32()); } public ClientVersion randomClientVersion() { diff --git a/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/forkchoice/ProposersDataManager.java b/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/forkchoice/ProposersDataManager.java index ed130f50c45..d32f9e6fed3 100644 --- a/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/forkchoice/ProposersDataManager.java +++ b/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/forkchoice/ProposersDataManager.java @@ -32,7 +32,6 @@ import tech.pegasys.teku.infrastructure.ssz.SszList; import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.config.SpecConfigDeneb; import tech.pegasys.teku.spec.datastructures.blocks.SlotAndBlockRoot; import tech.pegasys.teku.spec.datastructures.builder.SignedValidatorRegistration; import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState; @@ -238,12 +237,6 @@ private Optional calculatePayloadBuildingAttributes( .map(RegisteredValidatorInfo::getSignedValidatorRegistration); final Eth1Address feeRecipient = getFeeRecipient(proposerInfo, blockSlot); - final Optional maybeDenebConfig = - spec.atSlot(blockSlot).getConfig().toVersionDeneb(); - final Optional maxBlobsPerBlock = - maybeDenebConfig.map(SpecConfigDeneb::getMaxBlobsPerBlock).map(UInt64::valueOf); - final Optional targetBlobsPerBlock = - maybeDenebConfig.map(SpecConfigDeneb::getTargetBlobsPerBlock).map(UInt64::valueOf); return Optional.of( new PayloadBuildingAttributes( @@ -254,9 +247,7 @@ private Optional calculatePayloadBuildingAttributes( feeRecipient, validatorRegistration, spec.getExpectedWithdrawals(state), - currentHeadBlockRoot, - targetBlobsPerBlock, - maxBlobsPerBlock)); + currentHeadBlockRoot)); } // this function MUST return a fee recipient. diff --git a/ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/forkchoice/ForkChoiceNotifierTest.java b/ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/forkchoice/ForkChoiceNotifierTest.java index 334b5acb287..31034f62e4e 100644 --- a/ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/forkchoice/ForkChoiceNotifierTest.java +++ b/ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/forkchoice/ForkChoiceNotifierTest.java @@ -1095,8 +1095,6 @@ private PayloadBuildingAttributes getExpectedPayloadBuildingAttributes( overrideFeeRecipient.orElse(dataStructureUtil.randomEth1Address()); final UInt64 timestamp = spec.computeTimeAtSlot(headState, blockSlot); final Bytes32 random = spec.getRandaoMix(headState, UInt64.ZERO); - final Optional maxBlobsPerBlock = - spec.getMaxBlobsPerBlockForHighestMilestone().map(UInt64::valueOf); return new PayloadBuildingAttributes( proposerIndex, blockSlot, @@ -1105,9 +1103,7 @@ private PayloadBuildingAttributes getExpectedPayloadBuildingAttributes( feeRecipient, validatorRegistration, dataStructureUtil.randomWithdrawalList(), - forkChoiceState.getHeadBlockRoot(), - maxBlobsPerBlock.map(maxBlobs -> maxBlobs.dividedBy(2)), - maxBlobsPerBlock); + forkChoiceState.getHeadBlockRoot()); } private ForkChoiceState getCurrentForkChoiceState() { diff --git a/ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/forkchoice/ProposersDataManagerTest.java b/ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/forkchoice/ProposersDataManagerTest.java index d616474340e..ad2ae3fbab6 100644 --- a/ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/forkchoice/ProposersDataManagerTest.java +++ b/ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/forkchoice/ProposersDataManagerTest.java @@ -14,35 +14,24 @@ package tech.pegasys.teku.statetransition.forkchoice; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; import java.util.List; import java.util.Optional; -import java.util.concurrent.ExecutionException; -import org.apache.tuweni.bytes.Bytes32; import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem; import org.hyperledger.besu.plugin.services.MetricsSystem; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.TestTemplate; import tech.pegasys.teku.ethereum.execution.types.Eth1Address; -import tech.pegasys.teku.infrastructure.async.SafeFuture; import tech.pegasys.teku.infrastructure.async.eventthread.EventThread; -import tech.pegasys.teku.infrastructure.async.eventthread.InlineEventThread; import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.spec.Spec; import tech.pegasys.teku.spec.TestSpecContext; import tech.pegasys.teku.spec.TestSpecFactory; import tech.pegasys.teku.spec.TestSpecInvocationContextProvider; -import tech.pegasys.teku.spec.config.SpecConfigDeneb; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState; import tech.pegasys.teku.spec.datastructures.validator.BeaconPreparableProposer; import tech.pegasys.teku.spec.executionlayer.ExecutionLayerChannel; -import tech.pegasys.teku.spec.executionlayer.ForkChoiceState; -import tech.pegasys.teku.spec.executionlayer.PayloadBuildingAttributes; import tech.pegasys.teku.spec.util.DataStructureUtil; -import tech.pegasys.teku.storage.client.ChainHead; import tech.pegasys.teku.storage.client.RecentChainData; @TestSpecContext(allMilestones = true) @@ -58,7 +47,6 @@ class ProposersDataManagerTest { private DataStructureUtil dataStructureUtil; private ProposersDataManager manager; private Eth1Address defaultAddress; - private UInt64 currentForkFirstSlot; @BeforeEach public void setUp(final TestSpecInvocationContextProvider.SpecContext specContext) { @@ -71,7 +59,6 @@ public void setUp(final TestSpecInvocationContextProvider.SpecContext specContex case DENEB -> TestSpecFactory.createMinimalWithDenebForkEpoch(currentForkEpoch); case ELECTRA -> TestSpecFactory.createMinimalWithElectraForkEpoch(currentForkEpoch); }; - currentForkFirstSlot = spec.computeStartSlotAtEpoch(currentForkEpoch); dataStructureUtil = specContext.getDataStructureUtil(); defaultAddress = dataStructureUtil.randomEth1Address(); manager = @@ -111,58 +98,4 @@ void validatorIsConnected_notFound_withExpiredPreparedProposer() { manager.updatePreparedProposers(proposers, UInt64.ONE); assertThat(manager.validatorIsConnected(UInt64.ONE, UInt64.valueOf(26))).isFalse(); } - - @TestTemplate - void shouldSetMaxAndTargetBlobCount() throws ExecutionException, InterruptedException { - final Spec specMock = mock(Spec.class); - when(specMock.computeEpochAtSlot(any())).thenReturn(currentForkEpoch); - final UInt64 timestamp = dataStructureUtil.randomUInt64(); - when(specMock.computeTimeAtSlot(any(), any())).thenReturn(timestamp); - final Bytes32 random = dataStructureUtil.randomBytes32(); - when(specMock.getRandaoMix(any(), any())).thenReturn(random); - when(specMock.atSlot(currentForkFirstSlot)).thenReturn(spec.atSlot(currentForkFirstSlot)); - final InlineEventThread eventThread = new InlineEventThread(); - manager = - new ProposersDataManager( - eventThread, - specMock, - metricsSystem, - channel, - recentChainData, - Optional.of(defaultAddress), - true); - eventThread.markAsOnEventThread(); - final ForkChoiceUpdateData forkChoiceUpdateDataMock = mock(ForkChoiceUpdateData.class); - when(forkChoiceUpdateDataMock.hasHeadBlockHash()).thenReturn(true); - final ForkChoiceState forkChoiceStateMock = mock(ForkChoiceState.class); - when(forkChoiceStateMock.getHeadBlockRoot()).thenReturn(dataStructureUtil.randomBytes32()); - when(forkChoiceUpdateDataMock.getForkChoiceState()).thenReturn(forkChoiceStateMock); - when(recentChainData.isJustifiedCheckpointFullyValidated()).thenReturn(true); - final ChainHead chainHeadMock = mock(ChainHead.class); - when(chainHeadMock.getSlot()).thenReturn(UInt64.ZERO); - when(chainHeadMock.getRoot()).thenReturn(dataStructureUtil.randomBytes32()); - when(recentChainData.getChainHead()).thenReturn(Optional.of(chainHeadMock)); - final BeaconState beaconStateMock = mock(BeaconState.class); - when(chainHeadMock.getState()).thenReturn(SafeFuture.completedFuture(beaconStateMock)); - final SafeFuture> payloadBuildingAttributesFuture = - manager.calculatePayloadBuildingAttributes( - currentForkFirstSlot, true, forkChoiceUpdateDataMock, false); - final Optional maybePayloadBuildingAttributes = - payloadBuildingAttributesFuture.get(); - assertThat(maybePayloadBuildingAttributes).isPresent(); - assertThat(maybePayloadBuildingAttributes.get().getTargetBlobCount()) - .isEqualTo( - spec.atSlot(currentForkFirstSlot) - .getConfig() - .toVersionDeneb() - .map(SpecConfigDeneb::getTargetBlobsPerBlock) - .map(UInt64::valueOf)); - assertThat(maybePayloadBuildingAttributes.get().getMaximumBlobCount()) - .isEqualTo( - spec.atSlot(currentForkFirstSlot) - .getConfig() - .toVersionDeneb() - .map(SpecConfigDeneb::getMaxBlobsPerBlock) - .map(UInt64::valueOf)); - } }