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

Stop monkey patching bn.js #2190

Open
paddyquinn opened this issue May 17, 2019 · 2 comments
Open

Stop monkey patching bn.js #2190

paddyquinn opened this issue May 17, 2019 · 2 comments

Comments

@paddyquinn
Copy link

Noticed this in dashcore-lib, which is a fork of this lib. The bn.js file within this lib pulls in the bn.js npm module and then dynamically overrides its methods. This makes for a very frustrating developer experience. More details can be found in the issue I opened in dashcore-lib.

@micahriggan
Copy link
Contributor

Agreed, there's a few things in bitcore-lib where we're polluting other modules. An MR to fix that would be greatly appreciated.

@HoOngEe
Copy link

HoOngEe commented Aug 16, 2019

Agreed, I also went through an absurd experience. After importing this lib I tried new BN("00cd667f8287be106305f9fa3e2a1706579a179b084dc8247c0e31ebc900df9d", 16).toBuffer("be", 32).length, but it returns 31!
Because this library modifies the method parametrization, I have to use new BN("00cd667f8287be106305f9fa3e2a1706579a179b084dc8247c0e31ebc900df9d", 16).toBuffer({endian: "big", size: 32}).length instead to get intended result.

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

No branches or pull requests

3 participants