-
Notifications
You must be signed in to change notification settings - Fork 121
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
v3.0.0 #57
Conversation
My goodness! The numbers look awesome! Any chance these changes could be contributed back to the elliptic? |
@indutny elliptic performance almost indistinguishable from secp256k1-node js
|
@fanatid what's the point of embedding it with changes then? |
There are two goal: code size (it's very important for browsers) and easiest code review (only secp256k1, nothing more). |
@fanatid this looks great. The only thing I'm not convinced of is embedding elliptic and hashjs. I don't know of code size gains can justify it. The downside is future maintainability. Its will be hard to track changes and bug fixes in hashjs and elliptic manually. Maybe there is middle ground here. We could breakup hash.js into minimodules, sha256.js , ripemd160, ect.. and do the same to elliptic. Then just include the modules that we need. @indutny what do you think about further modularizing hash.js and elliptic? |
I'm fine with modularizing things. |
I'm also not happy with "embedding", but for me, 2 points that I mentioned above is reasonable. I think we don't need modularizing elliptic or hash.js, we can just include elliptic version by default and in that moment give users ability using version without dependencies with next construction: |
I mark this PR as WIP. Please let me time to make PR to elliptic and write code for using elliptic in this project (not think that will be fast, because I will busy in nearest time). |
@fanatid wouldn't it make sense applying the non-breaking changes from this patch set to 2.x? |
It's look reasonable, but my main goal right now is finish v3.0.0 |
Elliptic was added as fallback, waiting indutny/elliptic#71, indutny/bn.js#97, indutny/bn.js#98, indutny/bn.js#99, indutny/bn.js#100 |
I don't really care that much. I prefer using elliptic because it may be more up to date. But I happy as long as it's an option. |
Agreed. Upstream version IMO should be prioritized. |
@fanatid in the elliptic fallback code you can use |
@wanderer should be fixed now, it was bug related with BN, carry in multiplication on number: 8d26e3a#diff-f0b4a946089e134cf321d6e452ff27a9L319 |
Use |
@fanatid is there a way more of your code to be merged back into bn/elliptic? When creating the benchmarks, did you just use stock elliptic or an updated version relying on a newer bn.js release? As the current elliptic release uses an ancient bn.js version. |
Oh, I even didn't know that elliptic uses bn.js^4.0.0. Looks that I should return to using toArray :( About benchmarks: stock elliptic. |
@fanatid I don't think the version is the problem. All the tests passing including pure js. The only problem is with in the browser |
ah i think the problem is here https://github.com/indutny/bn.js/blob/master/package.json#L34 |
PR indutny/bn.js/pull/115 fixes the browser problems |
@wanderer I don't want release with elliptic that uses bn.js^4.0.0, it shouldn't take much time for update bn.js in elliptic, I'll try today. EDIT: I was totally confused in packages versions. @wanderer let's wait |
Switching to elliptic, at least embedded version doesn't has tests for edge cases |
@fanatid ok sounds good |
@wanderer updated! |
@fanatid not only |
@axic I tried, but got assertion error from bn.js |
lgtm, awesome work @fanatid ! |
Thanks to all 🍰 |
Hmm, that shouldn't happen. Let me check. In any case toArrayLike became a public API so it is safe to use :) |
Continuance of #55
API changes:
compressed
flag to functions that gives public key as result.sign
bitcoin/secp256k1 updated to c18b869
JavaScript implementation:
v3.0.0-alpha.0 (dc2a0ef) benchmark (with improved bn.js):
v2.0.7 (9df019c benchmark:
Now version is tagged as v3.0.0-alpha.0, when bitcoin-core/secp256k1#352 (ecdh interface) and indutny/bn.js#94 (improve performance) will be resolved -- v3.0.0 can be released.
Special thanks to @indutny for awesome libraries: bn.js, elliptic and hash.js!