Upon trying to perform some cryptographic operations (e.g. open a password-protected wallet, sign a message, and probably (I haven't tested) sign/broadcast a transaction) with electrum-3.3.8, the following error occurs:
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/electrum/gui/qt/installwizard.py", line 261, in select_storage
File "/usr/lib/python3.7/site-packages/electrum/storage.py", line 181, in decrypt
s = zlib.decompress(ec_key.decrypt_message(self.raw, enc_magic))
File "/usr/lib/python3.7/site-packages/electrum/ecc.py", line 443, in decrypt_message
ecdh_key = (ephemeral_pubkey * self.secret_scalar).get_public_key_bytes(compressed=True)
File "/usr/lib/python3.7/site-packages/electrum/ecc.py", line 240, in __mul__
ecdsa_point = self._pubkey.point * other
File "/usr/lib/python3.7/site-packages/electrum/ecc_fast.py", line 125, in mul
public_pair_bytes = b'\4' + self.x().to_bytes(32, byteorder="big") + self.y().to_bytes(32, byteorder="big")
AttributeError: 'mpz' object has no attribute 'to_bytes'
It works fine with ecdsa-0.14.1-r1.
Steps to Reproduce:
There are various ways. Here is one:
1. Make sure electrum and ecdsa-0.15 are installed.
2. Start electrum with a password-protected wallet. (Use "electrum -v" to see traceback on console.)
3. Enter a password when prompted (even an incorrect one).
Error occurs, and electrum exits.
Wallet is opened (or incorrect password error).
Created attachment 643198 [details]
That's weird. I've just tried and I can open my wallet just fine, and I do have ecdsa-0.15 installed.
Hmm. Further testing. I made a fresh wallet with a password but not encrypted, under another user. It proceeded fine. However, attempting to sign a message still failed (electrum didn't close in this case).
(In reply to Daniel Dawson from comment #3)
> Hmm. Further testing. I made a fresh wallet with a password but not
> encrypted, under another user. It proceeded fine. However, attempting to
> sign a message still failed (electrum didn't close in this case).
Signing and verifying a message worked fine here.
It seems that in ecdsa-0.15 (but not -0.14.1-r1), class ecdsa.ellipticcurve.Point (among others) runs several of its parameters through mpz() from gmpy or gmpy2, and then later expects them to have a to_bytes() method as an int would. However, for me at least, mpz() returns an mpz object with no such method. I have dev-python/gmpy-2.0.8-r1. That seems to be the only version currently available, though.