diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/validator/GetNewBlockTest.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/validator/GetNewBlockTest.java index 88790f2decb..3e1afc35487 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/validator/GetNewBlockTest.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v1/validator/GetNewBlockTest.java @@ -21,6 +21,7 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import static tech.pegasys.teku.beaconrestapi.RestApiConstants.EXECUTION_PAYLOAD_ID; import static tech.pegasys.teku.beaconrestapi.RestApiConstants.RANDAO_REVEAL; import static tech.pegasys.teku.beaconrestapi.RestApiConstants.SLOT; import static tech.pegasys.teku.infrastructure.unsigned.UInt64.ONE; @@ -77,7 +78,7 @@ void shouldRequireThatRandaoRevealIsSet() throws Exception { void shouldReturnBlockWithoutGraffiti() throws Exception { final Map pathParams = Map.of(SLOT, "1"); final Map> queryParams = - Map.of(RANDAO_REVEAL, List.of(signature.toHexString())); + Map.of(RANDAO_REVEAL, List.of(signature.toHexString()), EXECUTION_PAYLOAD_ID, List.of("0")); Optional optionalBeaconBlock = Optional.of( new BeaconBlock(dataStructureUtil.randomBeaconBlock(dataStructureUtil.randomLong()))); @@ -102,7 +103,9 @@ void shouldReturnBlockWithGraffiti() throws Exception { RANDAO_REVEAL, List.of(signature.toHexString()), RestApiConstants.GRAFFITI, - List.of(graffiti.toHexString())); + List.of(graffiti.toHexString()), + EXECUTION_PAYLOAD_ID, + List.of("0")); Optional optionalBeaconBlock = Optional.of( new BeaconBlock(dataStructureUtil.randomBeaconBlock(dataStructureUtil.randomLong()))); @@ -124,7 +127,7 @@ void shouldReturnBlockWithGraffiti() throws Exception { @Test void shouldReturnServerErrorWhenRuntimeExceptionReceived() throws Exception { final Map> params = - Map.of(RANDAO_REVEAL, List.of(signature.toHexString())); + Map.of(RANDAO_REVEAL, List.of(signature.toHexString()), EXECUTION_PAYLOAD_ID, List.of("0")); when(context.queryParamMap()).thenReturn(params); when(context.pathParamMap()).thenReturn(Map.of(SLOT, "1")); when(provider.getMilestoneAtSlot(UInt64.ONE)).thenReturn(SpecMilestone.PHASE0); @@ -143,7 +146,7 @@ void shouldReturnServerErrorWhenRuntimeExceptionReceived() throws Exception { void shouldReturnBadRequestErrorWhenIllegalArgumentExceptionReceived() throws Exception { final Map> params = - Map.of(RANDAO_REVEAL, List.of(signature.toHexString())); + Map.of(RANDAO_REVEAL, List.of(signature.toHexString()), EXECUTION_PAYLOAD_ID, List.of("0")); when(context.pathParamMap()).thenReturn(Map.of(SLOT, "1")); when(context.queryParamMap()).thenReturn(params); when(provider.getMilestoneAtSlot(UInt64.ONE)).thenReturn(SpecMilestone.PHASE0); diff --git a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/validator/GetNewBlockV2Test.java b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/validator/GetNewBlockV2Test.java index 89d2a9da2e7..ce4f9ce828f 100644 --- a/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/validator/GetNewBlockV2Test.java +++ b/data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/validator/GetNewBlockV2Test.java @@ -17,6 +17,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import static tech.pegasys.teku.beaconrestapi.RestApiConstants.EXECUTION_PAYLOAD_ID; import static tech.pegasys.teku.beaconrestapi.RestApiConstants.RANDAO_REVEAL; import static tech.pegasys.teku.beaconrestapi.RestApiConstants.SLOT; import static tech.pegasys.teku.infrastructure.unsigned.UInt64.ONE; @@ -66,7 +67,7 @@ void shouldReturnBlockWithoutGraffiti() throws Exception { final Map pathParams = Map.of(SLOT, "1"); final SchemaObjectProvider schemaProvider = new SchemaObjectProvider(spec); final Map> queryParams = - Map.of(RANDAO_REVEAL, List.of(signature.toHexString())); + Map.of(RANDAO_REVEAL, List.of(signature.toHexString()), EXECUTION_PAYLOAD_ID, List.of("0")); final tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock randomBeaconBlock = dataStructureUtil.randomBeaconBlock(ONE); diff --git a/validator/remote/src/main/java/tech/pegasys/teku/validator/remote/apiclient/OkHttpValidatorRestApiClient.java b/validator/remote/src/main/java/tech/pegasys/teku/validator/remote/apiclient/OkHttpValidatorRestApiClient.java index e2c0a3451d1..3dd4681e4e8 100644 --- a/validator/remote/src/main/java/tech/pegasys/teku/validator/remote/apiclient/OkHttpValidatorRestApiClient.java +++ b/validator/remote/src/main/java/tech/pegasys/teku/validator/remote/apiclient/OkHttpValidatorRestApiClient.java @@ -167,11 +167,11 @@ public Optional createUnsignedBlock( final BLSSignature randaoReveal, final Optional graffiti, final UInt64 executionPayloadId) { - final Map pathParams = - Map.of("slot", slot.toString(), "execution_payload_id", executionPayloadId.toString()); + final Map pathParams = Map.of("slot", slot.toString()); final Map queryParams = new HashMap<>(); queryParams.put("randao_reveal", encodeQueryParam(randaoReveal)); graffiti.ifPresent(bytes32 -> queryParams.put("graffiti", encodeQueryParam(bytes32))); + queryParams.put("execution_payload_id", encodeQueryParam(executionPayloadId.toString())); if (useV2CreateBlock) { return get(