Skip to content

Commit

Permalink
Merge branch 'master' into apis-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdi-aouadi authored Oct 21, 2024
2 parents 2f79e45 + c3ff1d9 commit 3d05262
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
- Clean up old beacon states when switching from ARCHIVE to PRUNE or MINIMAL data storage mode

### Bug Fixes
- Fixed a block production issue for Validator Client (24.10.0 to 24.10.2 teku VC), where required headers were not provided for JSON payloads. Default SSZ block production was unaffected. The required header is in the beacon-api spec but was not updated in all places for the VC.
- Fixed a block production issue for Validator Client (24.10.0 to 24.10.2 teku VC), where required headers were not provided for JSON payloads. Default SSZ block production was unaffected.
- Block production now uses json data (more like 24.8.0 did than 24.10) if the Eth-Consensus-version header is absent.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import static org.mockito.Mockito.when;
import static tech.pegasys.teku.beaconrestapi.v1.validator.PostBlindedAndUnblindedBlockTest.Version.V1;
import static tech.pegasys.teku.beaconrestapi.v1.validator.PostBlindedAndUnblindedBlockTest.Version.V2;
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST;
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK;

import java.io.IOException;
Expand Down Expand Up @@ -204,14 +203,7 @@ private <T extends SszData> void postRequestAndAssert(
JsonUtil.serialize(request, signedBlockContainerSchema.getJsonTypeDefinition()),
params,
versionHeader)) {
if (version == V2 && versionHeader.isEmpty()) {
// the version header is required in V2 APIs
assertThat(response.code()).isEqualTo(SC_BAD_REQUEST);
} else {
// the version header is not required for V1 APIs, the header selector should fall back to
// the slot selector
assertThat(response.code()).isEqualTo(SC_OK);
}
assertThat(response.code()).isEqualTo(SC_OK);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import static tech.pegasys.teku.beaconrestapi.BeaconRestApiTypes.ETH_CONSENSUS_VERSION_TYPE;
import static tech.pegasys.teku.beaconrestapi.BeaconRestApiTypes.PARAMETER_BROADCAST_VALIDATION;
import static tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.MilestoneDependentTypesUtil.getSchemaDefinitionForAllSupportedMilestones;
import static tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.MilestoneDependentTypesUtil.headerBasedSelector;
import static tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.MilestoneDependentTypesUtil.headerBasedSelectorWithSlotFallback;
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_ACCEPTED;
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT;
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK;
Expand Down Expand Up @@ -114,8 +114,9 @@ broadcast but a different status code is returned (202). Pre-Bellatrix, this end
.milestoneAtSlot(blockContainer.getSlot())
.equals(milestone)),
context ->
headerBasedSelector(
headerBasedSelectorWithSlotFallback(
context.getHeaders(),
context.getBody(),
schemaDefinitionCache,
SchemaDefinitions::getSignedBlindedBlockContainerSchema),
spec::deserializeSignedBlindedBlockContainer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import static tech.pegasys.teku.beaconrestapi.BeaconRestApiTypes.ETH_CONSENSUS_VERSION_TYPE;
import static tech.pegasys.teku.beaconrestapi.BeaconRestApiTypes.PARAMETER_BROADCAST_VALIDATION;
import static tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.MilestoneDependentTypesUtil.getSchemaDefinitionForAllSupportedMilestones;
import static tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.MilestoneDependentTypesUtil.headerBasedSelector;
import static tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.MilestoneDependentTypesUtil.headerBasedSelectorWithSlotFallback;
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_ACCEPTED;
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT;
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK;
Expand Down Expand Up @@ -114,8 +114,9 @@ validation, a separate success response code (202) is used to indicate that the
.milestoneAtSlot(blockContainer.getSlot())
.equals(milestone)),
context ->
headerBasedSelector(
headerBasedSelectorWithSlotFallback(
context.getHeaders(),
context.getBody(),
schemaDefinitionCache,
SchemaDefinitions::getSignedBlockContainerSchema),
spec::deserializeSignedBlockContainer)
Expand Down

0 comments on commit 3d05262

Please sign in to comment.