Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove wtfnode #4156

Merged
merged 2 commits into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions packages/api/src/routes/lodestar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ export type LodestarNodePeer = NodePeer & {
};

export type Api = {
/** TODO: description */
getWtfNode(): Promise<{data: string}>;
/** Trigger to write a heapdump to disk at `dirpath`. May take > 1min */
writeHeapdump(dirpath?: string): Promise<{data: {filepath: string}}>;
/** TODO: description */
Expand Down Expand Up @@ -98,7 +96,6 @@ export type Api = {
* Define javascript values for each route
*/
export const routesData: RoutesData<Api> = {
getWtfNode: {url: "/eth/v1/lodestar/wtfnode", method: "GET"},
writeHeapdump: {url: "/eth/v1/lodestar/writeheapdump", method: "POST"},
getLatestWeakSubjectivityCheckpointEpoch: {url: "/eth/v1/lodestar/ws_epoch", method: "GET"},
getSyncChainsDebugState: {url: "/eth/v1/lodestar/sync-chains-debug-state", method: "GET"},
Expand All @@ -117,7 +114,6 @@ export const routesData: RoutesData<Api> = {
};

export type ReqTypes = {
getWtfNode: ReqEmpty;
writeHeapdump: {query: {dirpath?: string}};
getLatestWeakSubjectivityCheckpointEpoch: ReqEmpty;
getSyncChainsDebugState: ReqEmpty;
Expand All @@ -137,7 +133,6 @@ export type ReqTypes = {

export function getReqSerializers(): ReqSerializers<Api, ReqTypes> {
return {
getWtfNode: reqEmpty,
writeHeapdump: {
writeReq: (dirpath) => ({query: {dirpath}}),
parseReq: ({query}) => [query.dirpath],
Expand Down Expand Up @@ -179,7 +174,6 @@ export function getReqSerializers(): ReqSerializers<Api, ReqTypes> {
/* eslint-disable @typescript-eslint/naming-convention */
export function getReturnTypes(): ReturnTypes<Api> {
return {
getWtfNode: sameType(),
writeHeapdump: sameType(),
getLatestWeakSubjectivityCheckpointEpoch: sameType(),
getSyncChainsDebugState: jsonType("camel"),
Expand Down
3 changes: 1 addition & 2 deletions packages/lodestar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@
"snappyjs": "^0.6.0",
"stream-to-it": "^0.2.0",
"strict-event-emitter-types": "^2.0.0",
"varint": "^6.0.0",
"wtfnode": "^0.8.4"
"varint": "^6.0.0"
},
"devDependencies": {
"@types/bl": "^5.0.1",
Expand Down
23 changes: 0 additions & 23 deletions packages/lodestar/src/api/impl/lodestar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,6 @@ export function getLodestarApi({
let writingHeapdump = false;

return {
/**
* Get a wtfnode dump of all active handles
* Will only load the wtfnode after the first call, and registers async hooks
* and other listeners to the global process instance
*/
async getWtfNode() {
// Browser interop
if (typeof require !== "function") throw Error("NodeJS only");

// eslint-disable-next-line
const wtfnode = require("wtfnode");
const logs: string[] = [];
function logger(...args: string[]): void {
for (const arg of args) logs.push(arg);
}
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access */
wtfnode.setLogger("info", logger);
wtfnode.setLogger("warn", logger);
wtfnode.setLogger("error", logger);
wtfnode.dump();
return {data: logs.join("\n")};
},

async writeHeapdump(dirpath = ".") {
// Browser interop
if (typeof require !== "function") throw Error("NodeJS only");
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11778,11 +11778,6 @@ ws@7.2.3:
resolved "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz"
integrity sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==

wtfnode@^0.8.4:
version "0.8.4"
resolved "https://registry.npmjs.org/wtfnode/-/wtfnode-0.8.4.tgz"
integrity sha512-64GEKtMt/MUBuAm+8kHqP74ojjafzu00aT0JKsmkIwYmjRQ/odO0yhbzKLm+Z9v1gMla+8dwITRKzTAlHsB+Og==

xml2js@0.4.19:
version "0.4.19"
resolved "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz"
Expand Down