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

replace old libsecp256k1 fork with upstream & remove GMP dependency #128

Merged
merged 3 commits into from
Apr 24, 2022

Conversation

spoonincode
Copy link
Member

Replace the old libsecp256k1 fork with upstream. The initial motivation for this change was performance: upstream libsecp256k1 can make use of now expired patented optimizations that significantly reduce the amount of time to perform key recovery.

There are two other significant benefits though. The previous fork in use was many many years old and some users have voiced concern about usage of such stale forks (EOSIO/eos#8984). It's certainly desirable to get back on track with the upstream repository. Plus, this latest version of libsecp256k1 no longer needs GMP to perform at optimal speed -- they've even completely removed that code path from the library. GMP is an LGPL library and removing it as a dependency opens up the possibility for future positive changes to binary releases. Besides, removing dependencies always make me smile these days. 😉

My measurements of the performance improvement for K1 key recovery:

CPU Previous New
Intel 9600k 50µs 33µs
AMD 5950X 51µs 35µs

(exact performance numbers will vary based on hardware and many other factors; these numbers we gathered with only a single core loaded)

Much of the changes are over in eosnetworkfoundation/mandel-fc#19

Yes, this PR isn't touching the cicd or build scripts. I'm going to continue to ignore those with the hope something good can come along before 3.1 release 😈

This ports over EOSIO/eos#9885 (and EOSIO/fc#180) but then adds on top of it: an even newer version of libsecp256k1 is used vs that late 2020 change which both slightly boosts performance more and allows removal of GMP. I've also wired in libsecp256k1's unit tests.

@spoonincode spoonincode merged commit b5d7d42 into main Apr 24, 2022
@spoonincode spoonincode deleted the new_libsecp256k1 branch April 24, 2022 04:30
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

Successfully merging this pull request may close these issues.

2 participants