diff --git a/package.json b/package.json index 82615778a940..4712465c87b7 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "@types/chai": "4.2.0", "@types/chai-as-promised": "^7.1.2", "@types/mocha": "^8.0.3", - "@types/node": "^14.14.17", + "@types/node": "^18.6.1", "@types/sinon": "^9.0.0", "@typescript-eslint/eslint-plugin": "5.26.0", "@typescript-eslint/parser": "5.26.0", diff --git a/packages/beacon-node/src/chain/clock/LocalClock.ts b/packages/beacon-node/src/chain/clock/LocalClock.ts index da4fa6bd5661..79142eaad99f 100644 --- a/packages/beacon-node/src/chain/clock/LocalClock.ts +++ b/packages/beacon-node/src/chain/clock/LocalClock.ts @@ -14,7 +14,7 @@ import {IBeaconClock} from "./interface.js"; export class LocalClock implements IBeaconClock { private readonly config: IChainForkConfig; private readonly genesisTime: number; - private timeoutId: number; + private timeoutId: NodeJS.Timeout; private readonly emitter: ChainEventEmitter; private readonly signal: AbortSignal; private _currentSlot: number; diff --git a/packages/beacon-node/test/memory/testRunnerMemory.ts b/packages/beacon-node/test/memory/testRunnerMemory.ts index 527546b1654b..8fb6f3e71773 100644 --- a/packages/beacon-node/test/memory/testRunnerMemory.ts +++ b/packages/beacon-node/test/memory/testRunnerMemory.ts @@ -8,6 +8,10 @@ export type TestRunnerMemoryOpts = { convergeFactor?: number; }; +if (global.gc === undefined) { + throw Error("Must enable global.gc"); +} + export async function testRunnerMemoryGc(opts: TestRunnerMemoryOpts): Promise { const { getInstance, @@ -25,11 +29,11 @@ export async function testRunnerMemoryGc(opts: TestRunnerMemoryOpts): Prom const usedMemoryArr: number[] = []; for (let n = 0; n < rounds; n++) { - global.gc(); - global.gc(); + global.gc?.(); + global.gc?.(); await new Promise((r) => setTimeout(r, 100)); - global.gc(); - global.gc(); + global.gc?.(); + global.gc?.(); const totalUsedMemoryPrev = computeUsedMemory(process.memoryUsage()); @@ -38,11 +42,11 @@ export async function testRunnerMemoryGc(opts: TestRunnerMemoryOpts): Prom refs.push(getInstance(i)); } - global.gc(); - global.gc(); + global.gc?.(); + global.gc?.(); await new Promise((r) => setTimeout(r, 100)); - global.gc(); - global.gc(); + global.gc?.(); + global.gc?.(); const totalUsedMemory = computeUsedMemory(process.memoryUsage()); @@ -98,8 +102,8 @@ export function testRunnerMemory(opts: TestRunnerMemoryOpts): number { // local vars will get garbage collected and won't show up in the .m result if (i % sampleEvery === 0) { - global.gc(); - global.gc(); + global.gc?.(); + global.gc?.(); const memoryUsage = process.memoryUsage(); const usedMemory = computeUsedMemory(memoryUsage); diff --git a/yarn.lock b/yarn.lock index 7d8558f537a0..320c78b1f8ba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2573,9 +2573,9 @@ integrity sha512-fZQQafSREFyuZcdWFAExYjBiCL7AUCdgsk80iO0q4yihYYdcIiH28CcuPTGFgLOCC8RlW49GSQxdHwZP+I7CNg== "@types/minipass@*": - version "2.2.0" - resolved "https://registry.npmjs.org/@types/minipass/-/minipass-2.2.0.tgz" - integrity sha512-wuzZksN4w4kyfoOv/dlpov4NOunwutLA/q7uc00xU02ZyUY+aoM5PWIXEKBMnm0NHd4a+N71BMjq+x7+2Af1fg== + version "3.1.2" + resolved "https://registry.yarnpkg.com/@types/minipass/-/minipass-3.1.2.tgz#e2d7f9df0698aff421dcf145b4fc05b8183b9030" + integrity sha512-foLGjgrJkUjLG/o2t2ymlZGEoBNBa/TfoUZ7oCTkOjP1T43UGBJspovJou/l3ZuHvye2ewR5cZNtp2zyWgILMA== dependencies: "@types/node" "*" @@ -2602,7 +2602,7 @@ "@types/node" "*" form-data "^3.0.0" -"@types/node@*", "@types/node@^14.14.17": +"@types/node@*": version "14.14.43" resolved "https://registry.npmjs.org/@types/node/-/node-14.14.43.tgz" integrity sha512-3pwDJjp1PWacPTpH0LcfhgjvurQvrZFBrC6xxjaUEZ7ifUtT32jtjPxEMMblpqd2Mvx+k8haqQJLQxolyGN/cQ== @@ -2617,6 +2617,11 @@ resolved "https://registry.npmjs.org/@types/node/-/node-16.6.2.tgz" integrity sha512-LSw8TZt12ZudbpHc6EkIyDM3nHVWKYrAvGy6EAJfNfjusbwnThqjqxUKKRwuV3iWYeW/LYMzNgaq3MaLffQ2xA== +"@types/node@^18.6.1": + version "18.6.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.6.1.tgz#828e4785ccca13f44e2fb6852ae0ef11e3e20ba5" + integrity sha512-z+2vB6yDt1fNwKOeGbckpmirO+VBDuQqecXkgeIqDlaOtmKn6hPR/viQ8cxCfqLU4fTlvM3+YjM367TukWdxpg== + "@types/normalize-package-data@^2.4.0": version "2.4.0" resolved "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz"