diff --git a/packages/api/src/beacon/routes/beacon/block.ts b/packages/api/src/beacon/routes/beacon/block.ts index cbf206e51a4a..73680ac0afc2 100644 --- a/packages/api/src/beacon/routes/beacon/block.ts +++ b/packages/api/src/beacon/routes/beacon/block.ts @@ -444,7 +444,16 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions { - const fork = toForkName(fromHeaders(headers, MetaHeader.Version)); + let fork: ForkName; + // As per spec, version header is optional for JSON requests + const versionHeader = fromHeaders(headers, MetaHeader.Version, false); + if (versionHeader !== undefined) { + fork = toForkName(versionHeader); + } else { + // Determine fork from slot in JSON payload + fork = config.getForkName((body as SignedBlindedBeaconBlock).message.slot); + } + return { signedBlindedBlock: getExecutionForkTypes(fork).SignedBlindedBeaconBlock.fromJson(body), };