diff --git a/.changeset/fix-cli-post-bundle-error-handler.md b/.changeset/fix-cli-post-bundle-error-handler.md new file mode 100644 index 00000000000..fc7edf23aa0 --- /dev/null +++ b/.changeset/fix-cli-post-bundle-error-handler.md @@ -0,0 +1,5 @@ +--- +'@hyperlane-xyz/cli': patch +--- + +Fixed broken error handler in ncc.post-bundle.mjs that referenced undefined variables in the catch block. diff --git a/.changeset/suppress-cli-warnings.md b/.changeset/suppress-cli-warnings.md new file mode 100644 index 00000000000..c92f4255768 --- /dev/null +++ b/.changeset/suppress-cli-warnings.md @@ -0,0 +1,7 @@ +--- +'@hyperlane-xyz/cli': patch +'@hyperlane-xyz/rebalancer': patch +'@hyperlane-xyz/warp-monitor': patch +--- + +Suppressed harmless startup warnings via pnpm patches instead of runtime suppression. The bigint-buffer native bindings warning and node-fetch .data deprecation warning are now patched at the source, avoiding the need for --no-warnings flags or console.warn overrides. diff --git a/package.json b/package.json index 8f76d6e3f08..3b90dc83de3 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,9 @@ "patchedDependencies": { "typechain@8.3.2": "patches/typechain@8.3.2.patch", "node-fetch@2.7.0": "patches/node-fetch@2.7.0.patch", - "@provablehq/sdk@0.9.14": "patches/@provablehq__sdk@0.9.14.patch" + "@provablehq/sdk@0.9.14": "patches/@provablehq__sdk@0.9.14.patch", + "bigint-buffer@1.1.5": "patches/bigint-buffer@1.1.5.patch", + "node-fetch@3.3.2": "patches/node-fetch@3.3.2.patch" } } } diff --git a/patches/bigint-buffer@1.1.5.patch b/patches/bigint-buffer@1.1.5.patch new file mode 100644 index 00000000000..52da9f78d7d --- /dev/null +++ b/patches/bigint-buffer@1.1.5.patch @@ -0,0 +1,13 @@ +diff --git a/dist/node.js b/dist/node.js +index 513168c89e387668a79b6beb109587b3eb41a7d0..613db0461be415b8256e5ada06701da887dd5b5c 100644 +--- a/dist/node.js ++++ b/dist/node.js +@@ -7,7 +7,7 @@ let converter; + converter = require('bindings')('bigint_buffer'); + } + catch (e) { +- console.warn('bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)'); ++ // Silently fall back to pure JS implementation + } + } + /** diff --git a/patches/node-fetch@3.3.2.patch b/patches/node-fetch@3.3.2.patch new file mode 100644 index 00000000000..0fdfdcdc884 --- /dev/null +++ b/patches/node-fetch@3.3.2.patch @@ -0,0 +1,24 @@ +diff --git a/src/request.js b/src/request.js +index af2ebc8e9b6f11783435d3c951eaef500fabbfdc..1872aaa6736392db85ce4d631fcb22ee89153f4d 100644 +--- a/src/request.js ++++ b/src/request.js +@@ -7,7 +7,6 @@ + */ + + import {format as formatUrl} from 'node:url'; +-import {deprecate} from 'node:util'; + import Headers from './headers.js'; + import Body, {clone, extractContentType, getTotalBytes} from './body.js'; + import {isAbortSignal} from './utils/is.js'; +@@ -31,9 +30,8 @@ const isRequest = object => { + ); + }; + +-const doBadDataWarn = deprecate(() => {}, +- '.data is not a valid RequestInit property, use .body instead', +- 'https://github.com/node-fetch/node-fetch/issues/1000 (request)'); ++// Silenced: .data deprecation warning (gaxios compatibility) ++const doBadDataWarn = () => {}; + + /** + * Request class diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 78cfd799aad..27fd5603cc0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -291,9 +291,15 @@ patchedDependencies: '@provablehq/sdk@0.9.14': hash: c53a252e5d7b2f4acbe743daa3febb6f448ac3b131eaad95952c9e3995999277 path: patches/@provablehq__sdk@0.9.14.patch + bigint-buffer@1.1.5: + hash: cd06d79b9cff13280e1a45a0f15abf67bc4ada4d7ad42bdfe120982ffa4340a2 + path: patches/bigint-buffer@1.1.5.patch node-fetch@2.7.0: hash: 59af5fd5e6879432f6c8aaafe72ade0e018951d8576db2aedda3d59e5a7bc024 path: patches/node-fetch@2.7.0.patch + node-fetch@3.3.2: + hash: 9872737c7a2d7862012132c60c476cac6a03a48fe575d80388b4ba1176583bf9 + path: patches/node-fetch@3.3.2.patch typechain@8.3.2: hash: fbb49bf3d1f71d8430767373c9ae33cd36e1aedd8ae9584d00dc90775f804950 path: patches/typechain@8.3.2.patch @@ -577,7 +583,7 @@ importers: version: 1.3.0 node-fetch: specifier: ^3.3.2 - version: 3.3.2 + version: 3.3.2(patch_hash=9872737c7a2d7862012132c60c476cac6a03a48fe575d80388b4ba1176583bf9) prettier: specifier: 'catalog:' version: 3.5.3 @@ -23842,7 +23848,7 @@ snapshots: dependencies: '@solana/buffer-layout': 4.0.1 '@solana/web3.js': 1.98.4(bufferutil@4.0.9)(typescript@5.8.3)(utf-8-validate@5.0.10) - bigint-buffer: 1.1.5 + bigint-buffer: 1.1.5(patch_hash=cd06d79b9cff13280e1a45a0f15abf67bc4ada4d7ad42bdfe120982ffa4340a2) bignumber.js: 9.3.1 transitivePeerDependencies: - bufferutil @@ -28001,7 +28007,7 @@ snapshots: big.js@6.2.2: {} - bigint-buffer@1.1.5: + bigint-buffer@1.1.5(patch_hash=cd06d79b9cff13280e1a45a0f15abf67bc4ada4d7ad42bdfe120982ffa4340a2): dependencies: bindings: 1.5.0 @@ -33102,7 +33108,7 @@ snapshots: dependencies: whatwg-url: 5.0.0 - node-fetch@3.3.2: + node-fetch@3.3.2(patch_hash=9872737c7a2d7862012132c60c476cac6a03a48fe575d80388b4ba1176583bf9): dependencies: data-uri-to-buffer: 4.0.1 fetch-blob: 3.2.0 diff --git a/typescript/cli/cli.ts b/typescript/cli/cli.ts index f9a02513429..a8e3867bf34 100644 --- a/typescript/cli/cli.ts +++ b/typescript/cli/cli.ts @@ -4,7 +4,6 @@ import yargs from 'yargs'; import type { LogFormat, LogLevel } from '@hyperlane-xyz/utils'; -import './env.js'; import { avsCommand } from './src/commands/avs.js'; import { configCommand } from './src/commands/config.js'; import { coreCommand } from './src/commands/core.js'; diff --git a/typescript/cli/env.ts b/typescript/cli/env.ts deleted file mode 100644 index b658ce5804c..00000000000 --- a/typescript/cli/env.ts +++ /dev/null @@ -1,15 +0,0 @@ -// This file isn't in the src dir so it it's imported before others -// See https://github.com/trivago/prettier-plugin-sort-imports/issues/112 - -// Workaround for bug in bigint-buffer which solana-web3.js depends on -// https://github.com/no2chem/bigint-buffer/issues/31#issuecomment-1752134062 -const defaultWarn = console.warn; -console.warn = (...args) => { - if ( - args && - typeof args[0] === 'string' && - args[0]?.includes('bigint: Failed to load bindings') - ) - return; - defaultWarn(...args); -}; diff --git a/typescript/cli/scripts/ncc.post-bundle.mjs b/typescript/cli/scripts/ncc.post-bundle.mjs index 98c34168e7b..1371b0321a8 100644 --- a/typescript/cli/scripts/ncc.post-bundle.mjs +++ b/typescript/cli/scripts/ncc.post-bundle.mjs @@ -53,12 +53,7 @@ async function patchCliExecutable() { ); } catch (error) { console.error('✖ Failed to patch CLI executable:', error); - if (!content.includes(dirnameDef)) { - const [, executable] = content.split(shebang); - const newContent = `${shebang}\n${dirnameDef}\n${executable}`; - await writeFile(outputFile, newContent, 'utf8'); - console.log('Adding missing __dirname definition to cli executable'); - } + process.exit(1); } }