Page MenuHomePhabricator

[electrum] use pycryptodomex everywhere, drop pycryptodome
ClosedPublic

Authored by PiRK on Jun 27 2023, 12:50.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC9533c4d21067: [electrum] use pycryptodomex everywhere, drop pycryptodome
Summary

pycryptodome and pycryptodomex are the exact same library with a slightly different API. Settle on using pycryptodomex everywhere. This removes the double dependency, which currently installed two different versions when packaging the binaries.

See:

tl;dr;

The installation procedure depends on the package you want the library to be in. PyCryptodome can be used as:

  • an almost drop-in replacement for the old PyCrypto library. You install it with:

    pip install pycryptodome

    In this case, all modules are installed under the Crypto package. One must avoid having both PyCrypto and PyCryptodome installed at the same time, as they will interfere with each other.

    This option is therefore recommended only when you are sure that the whole application is deployed in a virtualenv.
  • a library independent of the old PyCrypto. You install it with:

    pip install pycryptodomex

    In this case, all modules are installed under the Cryptodome package. PyCrypto and PyCryptodome can coexist.

As this is already a de-facto requirement (a wallet with many addresses will be significantly slowed down when it is not available), add it to the main requirements.txt rather than requirements-binaries.txt

Depends on D14131

Test Plan

This shows that the only remaining reference to pycryptodome is in an old release note.

grep -r pycryptodome | wc -l
grep -r pycryptodomex | wc -l
grep -r pycryptodome[^x]

grep -r Crypto to check that Crypto is no longer imported anywhere.

Run unit tests, run the application.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable