Skip to content

Commit

Permalink
chore: review proof routes (#6843)
Browse files Browse the repository at this point in the history
Review proof routes
  • Loading branch information
nflaig authored Jun 3, 2024
1 parent 76d4e59 commit 12f4c97
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 39 deletions.
2 changes: 0 additions & 2 deletions packages/api/src/beacon/client/proof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Endpoints>;

/**
Expand Down
3 changes: 1 addition & 2 deletions packages/api/src/beacon/routes/proof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
});

Expand Down
35 changes: 0 additions & 35 deletions packages/api/src/beacon/server/proof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Endpoints>): FastifyRoutes<Endpoints> {
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);
// },
// },
// };
}

0 comments on commit 12f4c97

Please sign in to comment.