Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 726882

Summary: net-misc/electrum-3.3.8 incompatible with dev-python/ecdsa-0.15
Product: Gentoo Linux Reporter: Daniel Dawson <danielcdawson>
Component: Current packagesAssignee: Michał Górny <mgorny>
Status: RESOLVED OBSOLETE    
Severity: normal CC: blueness, jstein, luke-jr+gentoobugs
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: emerge --info

Description Daniel Dawson 2020-06-03 08:28:27 UTC
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
    self.temp_storage.decrypt(password)
  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.

Reproducible: Always

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).
Actual Results:  
Error occurs, and electrum exits.

Expected Results:  
Wallet is opened (or incorrect password error).
Comment 1 Daniel Dawson 2020-06-03 08:32:38 UTC
Created attachment 643198 [details]
emerge --info
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-06-03 17:37:54 UTC
That's weird.  I've just tried and I can open my wallet just fine, and I do have ecdsa-0.15 installed.
Comment 3 Daniel Dawson 2020-06-03 20:31:45 UTC
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).
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-06-03 20:38:27 UTC
(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.
Comment 5 Daniel Dawson 2020-06-04 00:54:53 UTC
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.