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

temporarily patch ethereumjs-util to use an implementation of stripHexPrefix that doesn't throw when pass a non string typed arg #16094

Merged
merged 1 commit into from
Oct 7, 2022
Merged
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
48 changes: 48 additions & 0 deletions patches/ethereumjs-util+7.1.5.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
diff --git a/node_modules/ethereumjs-util/dist.browser/internal.js b/node_modules/ethereumjs-util/dist.browser/internal.js
index 9f3888b..3803958 100644
--- a/node_modules/ethereumjs-util/dist.browser/internal.js
+++ b/node_modules/ethereumjs-util/dist.browser/internal.js
@@ -43,8 +43,9 @@ exports.isHexPrefixed = isHexPrefixed;
* @returns the string without 0x prefix
*/
var stripHexPrefix = function (str) {
- if (typeof str !== 'string')
- throw new Error("[stripHexPrefix] input must be type 'string', received ".concat(typeof str));
+ if (typeof str !== 'string'){
+ return str;
+ }
return isHexPrefixed(str) ? str.slice(2) : str;
};
exports.stripHexPrefix = stripHexPrefix;
diff --git a/node_modules/ethereumjs-util/dist/internal.js b/node_modules/ethereumjs-util/dist/internal.js
index 01a90a0..9f1d8cd 100644
--- a/node_modules/ethereumjs-util/dist/internal.js
+++ b/node_modules/ethereumjs-util/dist/internal.js
@@ -43,8 +43,9 @@ exports.isHexPrefixed = isHexPrefixed;
* @returns the string without 0x prefix
*/
const stripHexPrefix = (str) => {
- if (typeof str !== 'string')
- throw new Error(`[stripHexPrefix] input must be type 'string', received ${typeof str}`);
+ if (typeof str !== 'string'){
+ return str;
+ }
return isHexPrefixed(str) ? str.slice(2) : str;
};
exports.stripHexPrefix = stripHexPrefix;
diff --git a/node_modules/ethereumjs-util/src/internal.ts b/node_modules/ethereumjs-util/src/internal.ts
index 52032f5..8f6f5f8 100644
--- a/node_modules/ethereumjs-util/src/internal.ts
+++ b/node_modules/ethereumjs-util/src/internal.ts
@@ -42,8 +42,9 @@ export function isHexPrefixed(str: string): boolean {
* @returns the string without 0x prefix
*/
export const stripHexPrefix = (str: string): string => {
- if (typeof str !== 'string')
- throw new Error(`[stripHexPrefix] input must be type 'string', received ${typeof str}`)
+ if (typeof str !== 'string') {
+ return str;
+ }

return isHexPrefixed(str) ? str.slice(2) : str
}