Page MenuHomePhabricator

[electrum] don't use ecdsa for basic bytes <-> int conversion
ClosedPublic

Authored by PiRK on Aug 23 2024, 11:52.

Details

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 electrum#5947
https://github.com/spesmilo/electrum/pull/5947/commits/2cf213552822b0feda4775ed94719679bcb1efb4

Depends on D16665

Test Plan

python test_runner.py

Diff Detail

Repository
rABC Bitcoin ABC
Branch
electrum_crypto
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 30072
Build 59678: Build Diffelectrum-tests
Build 59677: arc lint + arc unit

Event Timeline

PiRK requested review of this revision.Aug 23 2024, 11:52
bytesofman added inline comments.
electrum/electrumabc/tests/test_ecc.py
34

do you think it makes sense to keep this 32 as a defined constant somewhere, e.g. PRIVATE_KEY_BYTECOUNT ?

repeated 4 times in this diff, isn't (widely) intuitive why this should be 32.

electrum/electrumabc/tests/test_ecc.py
34

You're right, that would improve things quite a bit.

replace the magic 32 number with a constant

This revision is now accepted and ready to land.Aug 27 2024, 19:08