Skip to content

Commit

Permalink
Apply changes from #6337
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig committed Jan 30, 2024
1 parent bd8ce9b commit 19282ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions packages/api/src/beacon/routes/beacon/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,12 @@ export type Endpoints = {
*
* param blockId Block identifier.
* Can be one of: "head" (canonical head in node's view), "genesis", "finalized", \<slot\>, \<hex encoded blockRoot with 0x prefix\>.
* @param indices Array of indices for blob sidecars to request for in the specified block. Returns all blob sidecars in the block if not specified.
* indices Array of indices for blob sidecars to request for in the specified block. Returns all blob sidecars in the block if not specified.
*/
getBlobSidecars: Endpoint<
"GET",
{blockId: BlockId},
{params: {block_id: string}},
{blockId: BlockId; indices?: number[]},
{params: {block_id: string}; query: {indices?: number[]}},
deneb.BlobSidecars,
ExecutionOptimisticMeta
>;
Expand Down Expand Up @@ -524,7 +524,11 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
getBlobSidecars: {
url: "/eth/v1/beacon/blob_sidecars/{block_id}",
method: "GET",
req: blockIdOnlyReq,
req: {
writeReq: ({blockId, indices}) => ({params: {block_id: String(blockId)}, query: {indices}}),
parseReq: ({params, query}) => ({blockId: params.block_id, indices: query.indices}),
schema: {params: {block_id: Schema.StringRequired}, query: {indices: Schema.UintArray}},
},
resp: {
data: ssz.deneb.BlobSidecars,
meta: ExecutionOptimisticCodec,
Expand Down
4 changes: 2 additions & 2 deletions packages/beacon-node/src/api/impl/beacon/blocks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ export function getBeaconBlockApi({
await publishBlock(signedBlockOrContents, opts);
},

async getBlobSidecars({blockId}) {
async getBlobSidecars({blockId, indices}) {
const {block, executionOptimistic} = await resolveBlockId(chain, blockId);
const blockRoot = config.getForkTypes(block.message.slot).BeaconBlock.hashTreeRoot(block.message);

Expand All @@ -414,7 +414,7 @@ export function getBeaconBlockApi({
}

return {
data: blobSidecars,
data: indices ? blobSidecars.filter(({index}) => indices.includes(index)) : blobSidecars,
meta: {executionOptimistic},
};
},
Expand Down

0 comments on commit 19282ff

Please sign in to comment.