Page MenuHomePhabricator

[electrum] secp256k1: Improve warning message by adding path and exception details
ClosedPublic

Authored by PiRK on Oct 30 2023, 10:50.

Details

Summary

To be better able to diagnose loading failures of libsecp256k1-0.dll
this patch adds a more detailed warning print to the failure case where
all tried paths and their errors are listed.

This is a backport of electroncash#2712

Note that sys.exc_info()[0] is not always very useful (it often just says OSError), so I changed the backport to print an even more detailled error.

Test Plan

With secp256k1 not available on the machine (on Linux delete electrum/electrumabc/libsecp256k1.so.0)

$ ./electrum-abc -v
[secp256k1] warning: libsecp256k1 library failed to load
[secp256k1] warning: loading from /home/pablo/dev/bitcoin-abc/electrum/electrumabc/libsecp256k1.so.0 failed with: /home/pierre/dev/bitcoin-abc/electrum/electrumabc/libsecp256k1.so.0: cannot open shared object file: No such file or directory
[secp256k1] warning: loading from libsecp256k1.so.0 failed with: libsecp256k1.so.0: cannot open shared object file: No such file or directory
[ecc] info: libsecp256k1 library not available, falling back to python-ecdsa. This means signing operations will be slower. Try running:
...

without this diff, the output is less verbose and less useful:

$ ./electrum-abc -v
[secp256k1] warning: libsecp256k1 library failed to load
[ecc] info: libsecp256k1 library not available, falling back to python-ecdsa. This means signing operations will be slower. Try running:

Diff Detail

Repository
rABC Bitcoin ABC
Branch
ec_pr2712
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 25472
Build 50525: Build Diffelectrum-tests
Build 50524: arc lint + arc unit

Event Timeline

PiRK requested review of this revision.Oct 30 2023, 10:50
PiRK retitled this revision from secp256k1: Improve warning message by adding path and exception details to [electrum] secp256k1: Improve warning message by adding path and exception details.Oct 30 2023, 10:51

code here looks good. i'm not getting the expected output from this test plan, though:

./electrum-abc -v

-> Electrum opens, lots of output, nothing about [secp256k1] warning

mb not following this correctly / need to be running it in some special condition?

code here looks good. i'm not getting the expected output from this test plan, though:

./electrum-abc -v

-> Electrum opens, lots of output, nothing about [secp256k1] warning

mb not following this correctly / need to be running it in some special condition?

I will edit the test plan to clarify that this output is printed only if the application fails to find any secp256k1 lib, which happens when running from source when contrib/make_secp256k1 was never executed (or its output is deleted) and the lib is not installed via a package manager

This revision is now accepted and ready to land.Oct 30 2023, 19:31