From 092be931f4d71c5f012eea726a73dab287e14306 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Mon, 3 Jun 2024 10:57:22 +0200 Subject: [PATCH] Review proof routes --- packages/api/src/beacon/client/proof.ts | 2 -- packages/api/src/beacon/routes/proof.ts | 3 +-- packages/api/src/beacon/server/proof.ts | 35 ------------------------- 3 files changed, 1 insertion(+), 39 deletions(-) diff --git a/packages/api/src/beacon/client/proof.ts b/packages/api/src/beacon/client/proof.ts index a375ee46a960..504afe324f3e 100644 --- a/packages/api/src/beacon/client/proof.ts +++ b/packages/api/src/beacon/client/proof.ts @@ -2,8 +2,6 @@ import {ChainForkConfig} from "@lodestar/config"; import {ApiClientMethods, IHttpClient, createApiClientMethods} from "../../utils/client/index.js"; import {Endpoints, getDefinitions} from "../routes/proof.js"; -// TODO: revisit, do we still need to override methods? Make sure we still return same format as previously - export type ApiClient = ApiClientMethods; /** diff --git a/packages/api/src/beacon/routes/proof.ts b/packages/api/src/beacon/routes/proof.ts index 4eadb9d4c5c7..5c20a0194fc5 100644 --- a/packages/api/src/beacon/routes/proof.ts +++ b/packages/api/src/beacon/routes/proof.ts @@ -8,8 +8,7 @@ import {ArrayOf} from "../../utils/codecs.js"; import {VersionCodec, VersionMeta} from "../../utils/metadata.js"; export const CompactMultiProofType = new ContainerType({ - // TODO ensure limit of all lists is sane - leaves: ArrayOf(ssz.Root), + leaves: ArrayOf(ssz.Root, 10000), descriptor: new ByteListType(2048), }); diff --git a/packages/api/src/beacon/server/proof.ts b/packages/api/src/beacon/server/proof.ts index 203ea0b48051..127509221d6c 100644 --- a/packages/api/src/beacon/server/proof.ts +++ b/packages/api/src/beacon/server/proof.ts @@ -3,41 +3,6 @@ import {ChainForkConfig} from "@lodestar/config"; import {ApplicationMethods, FastifyRoutes, createFastifyRoutes} from "../../utils/server/index.js"; import {Endpoints, getDefinitions} from "../routes/proof.js"; -// TODO: revisit, do we need still need to override handlers? - export function getRoutes(config: ChainForkConfig, methods: ApplicationMethods): FastifyRoutes { return createFastifyRoutes(getDefinitions(config), methods); - // const serverRoutes = createFastifyRoutes(definitions, methods); - - // return { - // // Non-JSON routes. Return binary - // getStateProof: { - // ...serverRoutes.getStateProof, - // handler: async (req) => { - // const args = definitions.getStateProof.req.parseReq(req); - // const {data} = await methods.getStateProof(args); - // const leaves = (data as CompactMultiProof).leaves; - // const response = new Uint8Array(32 * leaves.length); - // for (let i = 0; i < leaves.length; i++) { - // response.set(leaves[i], i * 32); - // } - // // Fastify 3.x.x will automatically add header `Content-Type: application/octet-stream` if Buffer - // return Buffer.from(response); - // }, - // }, - // getBlockProof: { - // ...serverRoutes.getBlockProof, - // handler: async (req) => { - // const args = definitions.getBlockProof.req.parseReq(req); - // const {data} = await methods.getBlockProof(args); - // const leaves = (data as CompactMultiProof).leaves; - // const response = new Uint8Array(32 * leaves.length); - // for (let i = 0; i < leaves.length; i++) { - // response.set(leaves[i], i * 32); - // } - // // Fastify 3.x.x will automatically add header `Content-Type: application/octet-stream` if Buffer - // return Buffer.from(response); - // }, - // }, - // }; }