Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

remove unecessary version guard #187

Closed
wants to merge 1 commit into from
Closed

Conversation

Firescar96
Copy link

This guard is making it impossible for developers to use this library without various hacks. I've seen a few complaints about it as well as hacky solutions to bypass it.

https://github.com/bitpay/bitcore-lib/search?q=versionGuard&type=Issues&utf8=✓
https://stackoverflow.com/questions/46315459/bitcore-more-than-one-instance-of-bitcore-lib-found
https://forum.bitcore.io/t/more-than-one-instance-of-bitcore-lib-found/699
https://stackoverflow.com/questions/45217988/error-more-than-one-instance-of-library-found
https://bitcoin.stackexchange.com/questions/46795/bitcore-error-more-than-one-instance-of-bitcore-lib-found
https://stackoverflow.com/questions/47010584/nodejs-eth-lightwallet-doesnt-allow-different-bitcore-lib-versions-among-submod
https://forum.bitcore.io/t/error-more-than-one-instance-of-bitcore-lib-found-please-make-sure-to-require-bitcore-lib-and-check-that-submodules-do-not-also-include-their-own-bitcore-lib-dependency/1612

Some of these issues were even marked as high priority, before being closed with the resolution as a hacky solution:

bitpay/bitcore#1454
bitpay/bitcore#1484
bitpay/bitcore#1328
bitpay/bitcore#1366
bitpay/bitcore#1486
bitpay/bitcore#1453
bitpay/bitcore#1454
bitpay/bitcore#1457
bitpay/bitcore#1232
bitpay/bitcore#1303
bitpay/bitcore#1144

#153
#67
bitpay/bitcore#1366
bitpay/bitcore#1232
bitpay/bitcore#1457
bitpay/bitcore-mnemonic#26
bitpay/bitcore-mnemonic#58
bitpay/i-made-this#15
bitpay/bitcore-wallet-service#643

People are just using delete global._bitcore or other hacks so this code is doing more harm than good.

@Firescar96
Copy link
Author

@matiu all the tests pass, are there other errors caused by deleting this code?

@fanatid
Copy link
Contributor

fanatid commented Dec 30, 2017

@Firescar96 you can not just remove version guard without any other changes.
You need remove all instanceof calls (nearly 50 calls in lib) first.

@Firescar96
Copy link
Author

I'm not sure what the version guard has to do with calls to instanceof. Calls like these?
https://github.com/bitpay/bitcore-lib/blob/484683f854ad8bcac8a5b0e197d5704f80ebdae6/lib/crypto/ecdsa.js

expect(a instanceof b).to.equal(true);

@fanatid
Copy link
Contributor

fanatid commented Dec 30, 2017

@Firescar96
Copy link
Author

Firescar96 commented Dec 30, 2017

I see. Another suggestion I saw was to make bitcore-lib a peer dependency. Looking at the releases NPM has supported peer dependencies for a couple years.

Would a solution be to do this for all of bitpay's other libraries, bitcore, bitcore-mnemonic, etc?

@Firescar96
Copy link
Author

closing this, bitpay/bitcore-mnemonic#61 is a replacement

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants