-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
make libsecp256k1 a mandatory dependency #5947
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(instead of python-ecdsa)
now libsecp256k1 is the only implementation
SomberNight
added a commit
that referenced
this pull request
Feb 18, 2020
regression since #5947 Traceback (most recent call last): File "...\electrum\electrum\base_wizard.py", line 339, in on_device self.plugin.setup_device(device_info, self, purpose) File "...\electrum\electrum\plugins\ledger\ledger.py", line 598, in setup_device client.get_xpub("m/44'/0'", 'standard') # TODO replace by direct derivation once Nano S > 1.1 File "...\electrum\electrum\plugins\ledger\ledger.py", line 55, in catch_exception return func(self, *args, **kwargs) File "...\electrum\electrum\plugins\ledger\ledger.py", line 124, in get_xpub eckey=ecc.ECPubkey(publicKey), File "...\electrum\electrum\ecc.py", line 145, in __init__ self._x, self._y = _x_and_y_from_pubkey_bytes(b) File "...\electrum\electrum\ecc.py", line 119, in _x_and_y_from_pubkey_bytes ret = _libsecp256k1.secp256k1_ec_pubkey_parse( ctypes.ArgumentError: argument 3: <class 'TypeError'>: wrong type
Fabcien
pushed a commit
to Bitcoin-ABC/bitcoin-abc
that referenced
this pull request
Aug 28, 2024
Summary: The public libraries are more trustworthy than third-party libs when it comes to security. See https://docs.python.org/3/library/secrets.html This is a partial backport of [[spesmilo/electrum#5947 | electrum#5947]] spesmilo/electrum@004acb9: ecc: abstract away some usage of python-ecdsa: randrange and spesmilo/electrum@120da27: util.randrange: use stdlib 'secrets' module instead of 'python-ecdsa' spesmilo/electrum@2c2e3f8: util.randrange: expand docstring Depends on D16664 Test Plan: Delete the rpcuser and rpcpassword lines from the config file (`~/.electrum-abc/config`), run Electrum ABC, check that the two lines are generated again in the config file. The code touched in mnemo.py is dead code is kept for historical reason. We still support restoring legacy electrum seed phrases even though we now only generate BIP39 seed phrases for new wallets. So we might as well keep the function for generating such legacy seeds for testing purposes. But there is no way to test it through the application. The change is pretty trivial, so it should be fine. Reviewers: #bitcoin_abc, bytesofman Reviewed By: #bitcoin_abc, bytesofman Subscribers: bytesofman Differential Revision: https://reviews.bitcoinabc.org/D16665
Fabcien
pushed a commit
to Bitcoin-ABC/bitcoin-abc
that referenced
this pull request
Aug 28, 2024
Summary: There are python builtin methods for that. It is also a good opportunity to remove the misleading Python 2 era `_to_string` terminology when the output is actually bytes. Partial backport of [[spesmilo/electrum#5947 | electrum#5947]] spesmilo/electrum@2cf2135 Depends on D16665 Test Plan: `python test_runner.py` Reviewers: #bitcoin_abc, bytesofman Reviewed By: #bitcoin_abc, bytesofman Subscribers: bytesofman Differential Revision: https://reviews.bitcoinabc.org/D16675
Fabcien
pushed a commit
to Bitcoin-ABC/ElectrumABC
that referenced
this pull request
Aug 28, 2024
Summary: The public libraries are more trustworthy than third-party libs when it comes to security. See https://docs.python.org/3/library/secrets.html This is a partial backport of [[spesmilo#5947 | electrum#5947]] spesmilo@004acb9: ecc: abstract away some usage of python-ecdsa: randrange and spesmilo@120da27: util.randrange: use stdlib 'secrets' module instead of 'python-ecdsa' spesmilo@2c2e3f8: util.randrange: expand docstring Depends on D16664 Test Plan: Delete the rpcuser and rpcpassword lines from the config file (`~/.electrum-abc/config`), run Electrum ABC, check that the two lines are generated again in the config file. The code touched in mnemo.py is dead code is kept for historical reason. We still support restoring legacy electrum seed phrases even though we now only generate BIP39 seed phrases for new wallets. So we might as well keep the function for generating such legacy seeds for testing purposes. But there is no way to test it through the application. The change is pretty trivial, so it should be fine. Reviewers: #bitcoin_abc, bytesofman Reviewed By: #bitcoin_abc, bytesofman Subscribers: bytesofman Differential Revision: https://reviews.bitcoinabc.org/D16665
Fabcien
pushed a commit
to Bitcoin-ABC/ElectrumABC
that referenced
this pull request
Aug 28, 2024
Summary: There are python builtin methods for that. It is also a good opportunity to remove the misleading Python 2 era `_to_string` terminology when the output is actually bytes. Partial backport of [[spesmilo#5947 | electrum#5947]] spesmilo@2cf2135 Depends on D16665 Test Plan: `python test_runner.py` Reviewers: #bitcoin_abc, bytesofman Reviewed By: #bitcoin_abc, bytesofman Subscribers: bytesofman Differential Revision: https://reviews.bitcoinabc.org/D16675
Fabcien
pushed a commit
to Bitcoin-ABC/bitcoin-abc
that referenced
this pull request
Sep 5, 2024
Summary: Make libsecp256k1 a mandatory dependency, drop the fallback pure-python code that was only used when running from sources without libsecp256k1 compiled. Hard fail is there is any import error or unavailable symbol in secp256k1 (lib compiled without a required module, lib from Bitcoin Core...) This is a partial backport of [[spesmilo/electrum#5947 | electrum#5947]] spesmilo/electrum@ad408ea Depends on D16687 Test Plan: `python test_runner.py` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Subscribers: Fabien Differential Revision: https://reviews.bitcoinabc.org/D16689
Fabcien
pushed a commit
to Bitcoin-ABC/bitcoin-abc
that referenced
this pull request
Sep 5, 2024
Summary: This is a partial backport of [[spesmilo/electrum#5947 | electrum#5947]] spesmilo/electrum@ab0c70e Depends on D16689 Test Plan: `python test_runner.py` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Subscribers: Fabien Differential Revision: https://reviews.bitcoinabc.org/D16690
Fabcien
pushed a commit
to Bitcoin-ABC/bitcoin-abc
that referenced
this pull request
Sep 5, 2024
Summary: Partial backport of [[spesmilo/electrum#5947 | electrum#5947]] spesmilo/electrum@288d793 Depends on D16690 Test Plan: python test_runner.py Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Subscribers: Fabien Differential Revision: https://reviews.bitcoinabc.org/D16705
Fabcien
pushed a commit
to Bitcoin-ABC/ElectrumABC
that referenced
this pull request
Sep 5, 2024
Summary: Make libsecp256k1 a mandatory dependency, drop the fallback pure-python code that was only used when running from sources without libsecp256k1 compiled. Hard fail is there is any import error or unavailable symbol in secp256k1 (lib compiled without a required module, lib from Bitcoin Core...) This is a partial backport of [[spesmilo#5947 | electrum#5947]] spesmilo@ad408ea Depends on D16687 Test Plan: `python test_runner.py` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Subscribers: Fabien Differential Revision: https://reviews.bitcoinabc.org/D16689
Fabcien
pushed a commit
to Bitcoin-ABC/ElectrumABC
that referenced
this pull request
Sep 5, 2024
Summary: This is a partial backport of [[spesmilo#5947 | electrum#5947]] spesmilo@ab0c70e Depends on D16689 Test Plan: `python test_runner.py` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Subscribers: Fabien Differential Revision: https://reviews.bitcoinabc.org/D16690
Fabcien
pushed a commit
to Bitcoin-ABC/ElectrumABC
that referenced
this pull request
Sep 5, 2024
Summary: Partial backport of [[spesmilo#5947 | electrum#5947]] spesmilo@288d793 Depends on D16690 Test Plan: python test_runner.py Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Subscribers: Fabien Differential Revision: https://reviews.bitcoinabc.org/D16705
roqqit
pushed a commit
to doged-io/doged
that referenced
this pull request
Nov 19, 2024
Summary: The public libraries are more trustworthy than third-party libs when it comes to security. See https://docs.python.org/3/library/secrets.html This is a partial backport of [[spesmilo/electrum#5947 | electrum#5947]] spesmilo/electrum@004acb9: ecc: abstract away some usage of python-ecdsa: randrange and spesmilo/electrum@120da27: util.randrange: use stdlib 'secrets' module instead of 'python-ecdsa' spesmilo/electrum@2c2e3f8: util.randrange: expand docstring Depends on D16664 Test Plan: Delete the rpcuser and rpcpassword lines from the config file (`~/.electrum-abc/config`), run Electrum ABC, check that the two lines are generated again in the config file. The code touched in mnemo.py is dead code is kept for historical reason. We still support restoring legacy electrum seed phrases even though we now only generate BIP39 seed phrases for new wallets. So we might as well keep the function for generating such legacy seeds for testing purposes. But there is no way to test it through the application. The change is pretty trivial, so it should be fine. Reviewers: #bitcoin_abc, bytesofman Reviewed By: #bitcoin_abc, bytesofman Subscribers: bytesofman Differential Revision: https://reviews.bitcoinabc.org/D16665
roqqit
pushed a commit
to doged-io/doged
that referenced
this pull request
Nov 19, 2024
Summary: There are python builtin methods for that. It is also a good opportunity to remove the misleading Python 2 era `_to_string` terminology when the output is actually bytes. Partial backport of [[spesmilo/electrum#5947 | electrum#5947]] spesmilo/electrum@2cf2135 Depends on D16665 Test Plan: `python test_runner.py` Reviewers: #bitcoin_abc, bytesofman Reviewed By: #bitcoin_abc, bytesofman Subscribers: bytesofman Differential Revision: https://reviews.bitcoinabc.org/D16675
roqqit
pushed a commit
to doged-io/doged
that referenced
this pull request
Nov 20, 2024
Summary: Make libsecp256k1 a mandatory dependency, drop the fallback pure-python code that was only used when running from sources without libsecp256k1 compiled. Hard fail is there is any import error or unavailable symbol in secp256k1 (lib compiled without a required module, lib from Bitcoin Core...) This is a partial backport of [[spesmilo/electrum#5947 | electrum#5947]] spesmilo/electrum@ad408ea Depends on D16687 Test Plan: `python test_runner.py` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Subscribers: Fabien Differential Revision: https://reviews.bitcoinabc.org/D16689
roqqit
pushed a commit
to doged-io/doged
that referenced
this pull request
Nov 20, 2024
Summary: This is a partial backport of [[spesmilo/electrum#5947 | electrum#5947]] spesmilo/electrum@ab0c70e Depends on D16689 Test Plan: `python test_runner.py` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Subscribers: Fabien Differential Revision: https://reviews.bitcoinabc.org/D16690
roqqit
pushed a commit
to doged-io/doged
that referenced
this pull request
Nov 20, 2024
Summary: Partial backport of [[spesmilo/electrum#5947 | electrum#5947]] spesmilo/electrum@288d793 Depends on D16690 Test Plan: python test_runner.py Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Subscribers: Fabien Differential Revision: https://reviews.bitcoinabc.org/D16705
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously we have been using
python-ecdsa
with some of its internals monkey-patched (with respective methods fromlibsecp256k1
). In that setup,libsecp256k1
used to be an optional dependency, which when available, notably, increased performance.For the Lightning Network, the extra performance is indispensable.
Further,
python-ecdsa
changed its internal API in recent versions, which resulted in breakage even whenlibsecp256k1
was available (aspython-ecdsa
was always used) (see #5927 and b14747e).This PR changes the elliptic crypto implementation to always directly use
libsecp256k1
, and thus makes it a required dependency.python-ecdsa
is almost completely removed as a dependency (only used bydnssec
, and for random number generation but that could easily be replaced).closes #5927
closes #5606