From e871db9223e8b9c565ceba0bfeaab1b3292d83c5 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Fri, 15 Nov 2024 11:22:32 +0700 Subject: [PATCH 1/2] feat: bitcoinjs-lib remove MAX_SAFE_INTEGER limitations --- .../bitcoinjs-lib-npm-5.2.0-f462e8de5e.patch | 19 ++++++++++++++ package.json | 4 ++- yarn.lock | 25 ++++++++++++++++++- 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 .yarn/patches/bitcoinjs-lib-npm-5.2.0-f462e8de5e.patch diff --git a/.yarn/patches/bitcoinjs-lib-npm-5.2.0-f462e8de5e.patch b/.yarn/patches/bitcoinjs-lib-npm-5.2.0-f462e8de5e.patch new file mode 100644 index 00000000000..9e6ce825de5 --- /dev/null +++ b/.yarn/patches/bitcoinjs-lib-npm-5.2.0-f462e8de5e.patch @@ -0,0 +1,19 @@ +diff --git a/src/bufferutils.js b/src/bufferutils.js +index a68fd31ceae3e9c465b09efd7b486fe60f88a965..e7bcf783ac92a4fcdf7ff32e31707bb2c10bfaed 100644 +--- a/src/bufferutils.js ++++ b/src/bufferutils.js +@@ -4,12 +4,12 @@ const types = require('./types'); + const typeforce = require('typeforce'); + const varuint = require('varuint-bitcoin'); + // https://github.com/feross/buffer/blob/master/index.js#L1127 +-function verifuint(value, max) { ++function verifuint(value, _max) { + if (typeof value !== 'number') + throw new Error('cannot write a non-number as a number'); + if (value < 0) + throw new Error('specified a negative value for writing an unsigned value'); +- if (value > max) throw new Error('RangeError: value out of range'); ++ // if (value > max) throw new Error('RangeError: value out of range'); + if (Math.floor(value) !== value) + throw new Error('value has a fractional component'); + } diff --git a/package.json b/package.json index b9215efdac6..853fbbdc2d5 100644 --- a/package.json +++ b/package.json @@ -311,6 +311,8 @@ "react-scripts/workbox-webpack-plugin": "^7.1.0", "p-queue": "^6.6.2", "web3": "4.2.1-dev.a0d6730.0", - "react-scripts@^5.0.1": "patch:react-scripts@npm%3A5.0.1#./.yarn/patches/react-scripts-npm-5.0.1-d06bd2d5ad.patch" + "react-scripts@^5.0.1": "patch:react-scripts@npm%3A5.0.1#./.yarn/patches/react-scripts-npm-5.0.1-d06bd2d5ad.patch", + "bitcoinjs-lib@^5.2.0": "patch:bitcoinjs-lib@npm%3A5.2.0#./.yarn/patches/bitcoinjs-lib-npm-5.2.0-f462e8de5e.patch", + "bitcoinjs-lib@^5.0.3": "patch:bitcoinjs-lib@npm%3A5.2.0#./.yarn/patches/bitcoinjs-lib-npm-5.2.0-f462e8de5e.patch" } } diff --git a/yarn.lock b/yarn.lock index f2b4532b81f..7affb1bbea3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18025,7 +18025,7 @@ __metadata: languageName: node linkType: hard -"bitcoinjs-lib@npm:^5.0.3, bitcoinjs-lib@npm:^5.2.0": +"bitcoinjs-lib@npm:5.2.0": version: 5.2.0 resolution: "bitcoinjs-lib@npm:5.2.0" dependencies: @@ -18048,6 +18048,29 @@ __metadata: languageName: node linkType: hard +"bitcoinjs-lib@patch:bitcoinjs-lib@npm%3A5.2.0#./.yarn/patches/bitcoinjs-lib-npm-5.2.0-f462e8de5e.patch::locator=%40shapeshiftoss%2Fweb%40workspace%3A.": + version: 5.2.0 + resolution: "bitcoinjs-lib@patch:bitcoinjs-lib@npm%3A5.2.0#./.yarn/patches/bitcoinjs-lib-npm-5.2.0-f462e8de5e.patch::version=5.2.0&hash=bf3b30&locator=%40shapeshiftoss%2Fweb%40workspace%3A." + dependencies: + bech32: ^1.1.2 + bip174: ^2.0.1 + bip32: ^2.0.4 + bip66: ^1.1.0 + bitcoin-ops: ^1.4.0 + bs58check: ^2.0.0 + create-hash: ^1.1.0 + create-hmac: ^1.1.3 + merkle-lib: ^2.0.10 + pushdata-bitcoin: ^1.0.1 + randombytes: ^2.0.1 + tiny-secp256k1: ^1.1.1 + typeforce: ^1.11.3 + varuint-bitcoin: ^1.0.4 + wif: ^2.0.1 + checksum: 5d9416a46fb915e7fb3c5905dd44d285c64a815f8ee6131d0bee79603ab6459245927e706113bca20ad233f6e637423b3faad394d31caccba6c0d2216b00c2f2 + languageName: node + linkType: hard + "bitcoinjs-message@npm:^2.0.0": version: 2.2.0 resolution: "bitcoinjs-message@npm:2.2.0" From 8749d72660ae7c516ba2dbde21108ad0600c06de Mon Sep 17 00:00:00 2001 From: kaladinlight <35275952+kaladinlight@users.noreply.github.com> Date: Fri, 15 Nov 2024 09:35:46 -0700 Subject: [PATCH 2/2] patch shapeshift fork of bitcoinjs-lib --- ...b-npm-5.2.0-shapeshift.2-e59ff81828.patch} | 5 +- package.json | 3 +- yarn.lock | 49 ++++++++++--------- 3 files changed, 28 insertions(+), 29 deletions(-) rename .yarn/patches/{bitcoinjs-lib-npm-5.2.0-f462e8de5e.patch => @shapeshiftoss-bitcoinjs-lib-npm-5.2.0-shapeshift.2-e59ff81828.patch} (75%) diff --git a/.yarn/patches/bitcoinjs-lib-npm-5.2.0-f462e8de5e.patch b/.yarn/patches/@shapeshiftoss-bitcoinjs-lib-npm-5.2.0-shapeshift.2-e59ff81828.patch similarity index 75% rename from .yarn/patches/bitcoinjs-lib-npm-5.2.0-f462e8de5e.patch rename to .yarn/patches/@shapeshiftoss-bitcoinjs-lib-npm-5.2.0-shapeshift.2-e59ff81828.patch index 9e6ce825de5..cf7f67c1736 100644 --- a/.yarn/patches/bitcoinjs-lib-npm-5.2.0-f462e8de5e.patch +++ b/.yarn/patches/@shapeshiftoss-bitcoinjs-lib-npm-5.2.0-shapeshift.2-e59ff81828.patch @@ -1,8 +1,8 @@ diff --git a/src/bufferutils.js b/src/bufferutils.js -index a68fd31ceae3e9c465b09efd7b486fe60f88a965..e7bcf783ac92a4fcdf7ff32e31707bb2c10bfaed 100644 +index a68fd31ceae3e9c465b09efd7b486fe60f88a965..14ac893566b9a87a3a2d3bd98aa5faacc4306850 100644 --- a/src/bufferutils.js +++ b/src/bufferutils.js -@@ -4,12 +4,12 @@ const types = require('./types'); +@@ -4,12 +4,11 @@ const types = require('./types'); const typeforce = require('typeforce'); const varuint = require('varuint-bitcoin'); // https://github.com/feross/buffer/blob/master/index.js#L1127 @@ -13,7 +13,6 @@ index a68fd31ceae3e9c465b09efd7b486fe60f88a965..e7bcf783ac92a4fcdf7ff32e31707bb2 if (value < 0) throw new Error('specified a negative value for writing an unsigned value'); - if (value > max) throw new Error('RangeError: value out of range'); -+ // if (value > max) throw new Error('RangeError: value out of range'); if (Math.floor(value) !== value) throw new Error('value has a fractional component'); } diff --git a/package.json b/package.json index 853fbbdc2d5..5af577f521d 100644 --- a/package.json +++ b/package.json @@ -312,7 +312,6 @@ "p-queue": "^6.6.2", "web3": "4.2.1-dev.a0d6730.0", "react-scripts@^5.0.1": "patch:react-scripts@npm%3A5.0.1#./.yarn/patches/react-scripts-npm-5.0.1-d06bd2d5ad.patch", - "bitcoinjs-lib@^5.2.0": "patch:bitcoinjs-lib@npm%3A5.2.0#./.yarn/patches/bitcoinjs-lib-npm-5.2.0-f462e8de5e.patch", - "bitcoinjs-lib@^5.0.3": "patch:bitcoinjs-lib@npm%3A5.2.0#./.yarn/patches/bitcoinjs-lib-npm-5.2.0-f462e8de5e.patch" + "@shapeshiftoss/bitcoinjs-lib@5.2.0-shapeshift.2": "patch:@shapeshiftoss/bitcoinjs-lib@npm%3A5.2.0-shapeshift.2#./.yarn/patches/@shapeshiftoss-bitcoinjs-lib-npm-5.2.0-shapeshift.2-e59ff81828.patch" } } diff --git a/yarn.lock b/yarn.lock index 7affb1bbea3..3815bd21b7b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11110,6 +11110,30 @@ __metadata: languageName: node linkType: hard +"@shapeshiftoss/bitcoinjs-lib@patch:@shapeshiftoss/bitcoinjs-lib@npm%3A5.2.0-shapeshift.2#./.yarn/patches/@shapeshiftoss-bitcoinjs-lib-npm-5.2.0-shapeshift.2-e59ff81828.patch::locator=%40shapeshiftoss%2Fweb%40workspace%3A.": + version: 5.2.0-shapeshift.2 + resolution: "@shapeshiftoss/bitcoinjs-lib@patch:@shapeshiftoss/bitcoinjs-lib@npm%3A5.2.0-shapeshift.2#./.yarn/patches/@shapeshiftoss-bitcoinjs-lib-npm-5.2.0-shapeshift.2-e59ff81828.patch::version=5.2.0-shapeshift.2&hash=6df42b&locator=%40shapeshiftoss%2Fweb%40workspace%3A." + dependencies: + bech32: ^1.1.2 + big-integer: ^1.6.44 + bip174: ^2.0.1 + bip32: ^2.0.4 + bip66: ^1.1.0 + bitcoin-ops: ^1.4.0 + bs58check: ^2.0.0 + create-hash: ^1.1.0 + create-hmac: ^1.1.3 + merkle-lib: ^2.0.10 + pushdata-bitcoin: ^1.0.1 + randombytes: ^2.0.1 + tiny-secp256k1: ^1.1.6 + typeforce: ^1.11.3 + varuint-bitcoin: ^1.0.4 + wif: ^2.0.1 + checksum: 8011bee8ea7970cc43ad62d27b34d210a62963cad8373c72c4310058c0dcdbe3c937a8da1b16762a03b78037bf3cbb4123f42a6fe293dfaa967d88b37492353c + languageName: node + linkType: hard + "@shapeshiftoss/blockbook@npm:^9.3.0": version: 9.3.0 resolution: "@shapeshiftoss/blockbook@npm:9.3.0" @@ -18025,7 +18049,7 @@ __metadata: languageName: node linkType: hard -"bitcoinjs-lib@npm:5.2.0": +"bitcoinjs-lib@npm:^5.0.3, bitcoinjs-lib@npm:^5.2.0": version: 5.2.0 resolution: "bitcoinjs-lib@npm:5.2.0" dependencies: @@ -18048,29 +18072,6 @@ __metadata: languageName: node linkType: hard -"bitcoinjs-lib@patch:bitcoinjs-lib@npm%3A5.2.0#./.yarn/patches/bitcoinjs-lib-npm-5.2.0-f462e8de5e.patch::locator=%40shapeshiftoss%2Fweb%40workspace%3A.": - version: 5.2.0 - resolution: "bitcoinjs-lib@patch:bitcoinjs-lib@npm%3A5.2.0#./.yarn/patches/bitcoinjs-lib-npm-5.2.0-f462e8de5e.patch::version=5.2.0&hash=bf3b30&locator=%40shapeshiftoss%2Fweb%40workspace%3A." - dependencies: - bech32: ^1.1.2 - bip174: ^2.0.1 - bip32: ^2.0.4 - bip66: ^1.1.0 - bitcoin-ops: ^1.4.0 - bs58check: ^2.0.0 - create-hash: ^1.1.0 - create-hmac: ^1.1.3 - merkle-lib: ^2.0.10 - pushdata-bitcoin: ^1.0.1 - randombytes: ^2.0.1 - tiny-secp256k1: ^1.1.1 - typeforce: ^1.11.3 - varuint-bitcoin: ^1.0.4 - wif: ^2.0.1 - checksum: 5d9416a46fb915e7fb3c5905dd44d285c64a815f8ee6131d0bee79603ab6459245927e706113bca20ad233f6e637423b3faad394d31caccba6c0d2216b00c2f2 - languageName: node - linkType: hard - "bitcoinjs-message@npm:^2.0.0": version: 2.2.0 resolution: "bitcoinjs-message@npm:2.2.0"