Commit Graph

82 Commits

Author SHA1 Message Date
SomberNight fc93e2ca4c ci: update electrumx 2025-06-13 23:53:29 +00:00
SomberNight 5fd6603ea6 ci: regtests: bump e-x 2025-05-29 17:29:27 +00:00
SomberNight 8198209149 ci: regtests: bump e-x 2025-05-28 14:45:47 +00:00
SomberNight 96f861a570 ci: add linter task "ban unicode" to protect against malicious unicode
This script scans the whole codebase for unicode characters and
errors if it finds any, unless the character is specifically whitelisted.

The motivation is to protect against homoglyph attacks, invisible unicode characters,
bidirectional and other control characters, and other malicious unicode usage.

Given that we mostly expect to use ASCII characters in the source code,
the most robust and generic fix seems to be to just ban all unicode usage.

see https://trojansource.codes/ :
> Compilers, interpreters, and build pipelines supporting Unicode should throw errors or warnings
> for unterminated bidirectional control characters in comments or string literals,
> and for identifiers with mixed-script confusable characters.
> Language specifications should formally disallow unterminated bidirectional
> control characters in comments and string literals.
> Code editors and repository frontends should make bidirectional control characters
> and mixed-script confusable characters perceptible with visual symbols or warnings.

also https://github.com/maltfield/detect-malicious-unicode
2025-05-09 18:03:25 +00:00
SomberNight d1e1ca7fd2 ci: fix "locale: upload to crowdin" task
follow-up https://github.com/spesmilo/electrum/pull/9726
2025-04-14 18:08:31 +00:00
SomberNight 31b176169a contrib: mv locale-related scripts to contrib/locale/ 2025-04-14 17:18:37 +00:00
SomberNight ef452b1f49 contrib/push_locale: update qt5->qt6 2025-04-07 17:16:02 +00:00
SomberNight 5c233ac325 ci: enable more flake8 stuff
```
$ export ELECTRUM_LINTERS=E9,E101,E129,E273,E274,E703,E71,E722,F5,F6,F7,F8,W191,W29,B
$ export ELECTRUM_LINTERS_IGNORE=B007,B009,B010,B019,B036,F541,F841
$ flake8 . --count --select="$ELECTRUM_LINTERS" --ignore="$ELECTRUM_LINTERS_IGNORE" --show-source --statistics --exclude "*_pb2.py,electrum/_vendor/"
./electrum/commands.py:98:1: F811 redefinition of unused 'format_satoshis' from line 48
def format_satoshis(x):
^
./electrum/commands.py:437:9: F811 redefinition of unused 'Mnemonic' from line 62
        from .mnemonic import Mnemonic
        ^
./electrum/gui/qt/wizard/wallet.py:37:5: F811 redefinition of unused 'Daemon' from line 14
    from electrum.daemon import Daemon
    ^
./electrum/lntransport.py:14:1: F811 redefinition of unused 'Optional' from line 12
from typing import NamedTuple, List, Tuple, Mapping, Optional, TYPE_CHECKING, Union, Dict, Set, Sequence
^
./electrum/lntransport.py:14:1: F811 redefinition of unused 'TYPE_CHECKING' from line 12
from typing import NamedTuple, List, Tuple, Mapping, Optional, TYPE_CHECKING, Union, Dict, Set, Sequence
^
./electrum/plugin.py:966:13: F811 redefinition of unused 'hid' from line 593
            import hid
            ^
./electrum/plugin.py:1040:13: F811 redefinition of unused 'hid' from line 593
            import hid
            ^
./electrum/util.py:44:1: F811 redefinition of unused 'json' from line 26
import json
^
./electrum/util.py:46:1: F811 redefinition of unused 'NamedTuple' from line 29
from typing import NamedTuple, Optional
^
./electrum/util.py:46:1: F811 redefinition of unused 'Optional' from line 29
from typing import NamedTuple, Optional
^
./electrum/util.py:1456:56: F811 redefinition of unused 'traceback' from line 34
        async def __aexit__(self, exc_type, exc_value, traceback):
                                                       ^
./electrum/wallet_db.py:536:9: F811 redefinition of unused 'LOCAL' from line 46
        LOCAL = 1
        ^
./electrum/wallet_db.py:537:9: F811 redefinition of unused 'REMOTE' from line 46
        REMOTE = -1
        ^
./tests/test_bitcoin.py:28:1: F811 redefinition of unused 'bitcoin' from line 9
from electrum import crypto, constants, bitcoin
^
./tests/test_txbatcher.py:11:1: F811 redefinition of unused 'Transaction' from line 7
from electrum.transaction import Transaction, PartialTxInput, PartialTxOutput, TxOutpoint
^
./tests/test_wallet_vertical.py:20:1: F811 redefinition of unused 'Transaction' from line 10
from electrum.transaction import Transaction, PartialTxOutput, tx_from_any, Sighash
^
16    F811 redefinition of unused 'format_satoshis' from line 48
16

```
2025-04-02 16:21:59 +00:00
SomberNight 55281295b7 ci: bump flake8 to new version
```
./electrum/commands.py:144:9: F824 `global known_commands` is unused: name is never assigned in scope
        global known_commands
        ^
./electrum/commands.py:1916:9: F824 `global known_commands` is unused: name is never assigned in scope
        global known_commands
        ^
./electrum/gui/qt/main_window.py:2405:13: F824 `nonlocal done` is unused: name is never assigned in scope
            nonlocal done
            ^
./electrum/i18n.py:52:5: F824 `global language` is unused: name is never assigned in scope
    global language
    ^
./electrum/plugin.py:189:9: F824 `global _root_permission_cache` is unused: name is never assigned in scope
        global _root_permission_cache
        ^
5     F824 `global known_commands` is unused: name is never assigned in scope
5

```
2025-04-02 14:56:53 +00:00
SomberNight f13983015d tests: run debug-mode unittests on python 3.13 2025-03-04 15:50:36 +00:00
SomberNight b55b8d183b ci: fix "regtest" task failing due to pip weirdness
pip was failing to install "electrum_aionostr>=0.0.7".
This was when using "python3-pip" from ubuntu 22.04 apt.

```
Discarding https://files.pythonhosted.org/packages/91/8b/95a16d58c8d02c6f8919fd41895c65312179d66abad5d70e9800c942ac61/electrum_aionostr-0.0.7.tar.gz#sha256=e0b45d608977891c3bb4f6a4dee9a4e843fa661ceca31f81e7b992e65117070a (from https://pypi.org/simple/electrum-aionostr/) (requires-python:>=3.8): Requested unknown from https://files.pythonhosted.org/packages/91/8b/95a16d58c8d02c6f8919fd41895c65312179d66abad5d70e9800c942ac61/electrum_aionostr-0.0.7.tar.gz#sha256=e0b45d608977891c3bb4f6a4dee9a4e843fa661ceca31f81e7b992e65117070a (from Electrum==4.5.8) has inconsistent name: filename has 'electrum-aionostr', but metadata has 'unknown'
```

Updating to newer pip directly using pip seems to fix this:
```
$ python3 -m pip install --user --upgrade pip
Requirement already satisfied: pip in /usr/lib/python3/dist-packages (22.0.2)
Collecting pip
  Downloading pip-25.0-py3-none-any.whl (1.8 MB)
```
2025-02-05 13:23:42 +00:00
SomberNight fb5a1af666 bump min required Python version to 3.10 2025-01-10 18:52:49 +00:00
ThomasV ab583c9b7e cirrus: follow-up previous commit 2024-12-08 10:16:28 +01:00
ThomasV 0d632348b9 cirrus: disable python3.8 unittests
see #9239
2024-12-08 10:08:33 +01:00
SomberNight c6a8b022bd ci: run tests also with python 3.13 2024-10-18 15:10:03 +00:00
SomberNight 3d7f3355cb ci: libsecp build: follow-up prev 2024-10-10 15:46:10 +00:00
ThomasV 9dbbd815a3 build scripts: add libsecp256k1 library to the electrum_ecc directory 2024-10-10 15:46:07 +00:00
SomberNight 05868666d6 ci: give more memory to Windows build
build is getting OOM killed.. maybe since Qt6 migration?
2024-10-07 19:01:10 +00:00
SomberNight aac3190cb1 ci: fix windows build caching
follow-up https://github.com/spesmilo/electrum/commit/fcc4e1d38773da0484910cacc80c16117b9c15c5

error msg was:
```
SHA for cache folders (/opt/wine64/drive_c/electrum/contrib/build-wine/.cache/win32/wine_pip_cache, /opt/wine64/drive_c/electrum/contrib/build-wine/.cache/win64/wine_pip_cache) is 'be33ad1b0598b1733992e36659bb71406f8fcfaa3a442166ecbe26e2db9a65c2'
Failed to tar caches for Upload 'pip' cache with error walking folder /opt/wine64/drive_c/electrum/contrib/build-wine/.cache/win32/wine_pip_cache: lstat /opt/wine64/drive_c/electrum/contrib/build-wine/.cache/win32/wine_pip_cache: no such file or directory!
```
2024-10-04 13:59:03 +00:00
SomberNight fcc4e1d387 wine build: build 64-bit windows binaries
required for qt6

related: https://github.com/spesmilo/electrum/issues/6598
2024-09-18 15:46:16 +00:00
SomberNight ebbdadb080 ci: follow-up: build own libsecp256k1 instead of using apt
follow-up https://github.com/spesmilo/electrum/commit/dbc69727bd93acca11e4d10cdeb9a32ccf99ff25
2024-05-29 13:30:49 +00:00
SomberNight dbc69727bd ci: unittests: build own libsecp256k1 instead of using apt
related https://github.com/spesmilo/electrum/commit/6bf7542b25fb08cae165930bfabbd08086d83ee5
2024-05-28 17:13:17 +00:00
SomberNight 6bf7542b25 ci: regtests: build own libsecp256k1 instead of using apt
- version in apt is too old (cirrus is using ubuntu 22.04 LTS atm) for schnorr module
- this way we have better control of exact version to use
2024-04-11 16:52:42 +00:00
Sander van Grieken 4c6421e162 tests: fix CI regtest new path 2024-02-16 17:41:34 +01:00
ghost43 5582b753e5 Merge pull request #8881 from accumulator/qobject_test
add a simple test framework for testing QObjects and their signal/slot mechanism
2024-02-15 14:46:50 +00:00
SomberNight 9a6ec61647 ci: also run unit tests with python 3.12 2024-02-15 14:22:31 +00:00
Sander van Grieken 71dbf76cd0 add new 'qml_gui' extra to setup.py and include it for tox 2024-02-12 11:29:05 +01:00
SomberNight d63253b30b ci: only run build tasks once per day (or on manual trigger)
related https://github.com/cirruslabs/cirrus-ci-docs/discussions/949
2024-01-16 17:28:08 +00:00
SomberNight 7de45c1325 ci: pin flake8 version
- new version of flake8-bugbear (24.1.16) introduced new tests (B036), which we were failing
- that's fine, but our CI should not suddenly break because of this
- better to do explicit manual version bumps of the linter
2024-01-16 16:31:56 +00:00
Sander van Grieken e561ce211b cirrus: task timeout 90m 2023-11-07 10:17:10 +01:00
ThomasV f98602918b Revert "Update .cirrus.yml"
This reverts commit 33ac0b4591.
2023-11-02 19:03:15 +01:00
robertmin2 33ac0b4591 Update .cirrus.yml 2023-10-31 16:57:52 +01:00
JeremyRand a3d7df48db Cirrus: Mark E722 linter as mandatory (#8668)
These linter warnings were all fixed in
312f2641e7, so making CI enforce them will
reduce the risk of regressions.

Co-authored-by: Jeremy Rand <jeremyrand@danwin1210.de>
2023-10-31 13:52:24 +00:00
ThomasV 8acb5dd7e9 CI: run unit tests in debug mode with python 3.11
Python 3.12 does not work with current aiohttp, see
https://github.com/aio-libs/aiohttp/issues/7229

It is currently possible to build a wheel using aiohttp==3.9.0b0.
However, unit tests fail in that case, because TestLNTransport::test_loop stalls.
2023-10-08 11:43:55 +02:00
SomberNight 43615487de follow-up prev 2023-09-06 16:24:11 +00:00
SomberNight 19718001e4 (trivial) CI: rename tasks 2023-09-06 16:21:18 +00:00
SomberNight b45c84f24f remove the kivy gui
We now use the qml gui on Android, and haven't been maintaining
the kivy GUI for a while.
2023-08-30 16:47:37 +00:00
SomberNight 111a753dc2 ci: don't run unit tests on pypy
We never really supported pypy - the CI was running the tests there
just to see compatibility.
A few of the unit tests consistently hang, resulting in the whole
test runner timing out and wasting compute resources. Someone could
debug the hangs and try to fix them, but I don't have the time.
2023-08-30 12:46:12 +00:00
SomberNight 5a4b98a066 CI: don't run unit tests on "python:rc", looks like it's unmaintained
The "python:rc" tag on dockerhub has not been updated for 2+ years
and is still at 3.10.0rc2. Even 3.11 has been released for many months now.
see https://hub.docker.com/_/python/tags
2023-08-04 18:18:24 +00:00
SomberNight 1767d26de9 tests: make regtest tests somewhat faster by faster polling in e-x
using https://github.com/spesmilo/electrumx/commit/4e66804dc0d668cd6bd4602b547e2f5b2e227e97

on my machine, before-after:
Ran 9 tests in 495.865s
Ran 9 tests in 376.183s
2023-07-14 15:18:36 +00:00
SomberNight e097a3f875 CI: add some task dependencies
run linter first, then tests, then binary builds
2023-04-24 13:37:01 +00:00
SomberNight 4cbb8399d2 CI: also run flake8-bugbear, as part of flake8 2023-04-24 13:00:12 +00:00
SomberNight 2be71c2dcc windows README: update reference to libsecp256k1-0.dll to incl newer
related: https://github.com/spesmilo/electrum/pull/8185
2023-04-21 16:38:58 +00:00
SomberNight f5eabaff55 ci: also run unit tests with PYTHONASYNCIODEBUG=1
This can reveal additional asyncio-related bugs,
and due to also enabling the full "debug mode", maybe more.
2023-02-20 16:53:18 +00:00
SomberNight c4061f143b CI: (trivial) make "Locale" task depend on same py version it uses 2023-01-30 17:36:05 +00:00
SomberNight 4f66afb8a8 refactor locale scripts
follow-up 000a3de571
2023-01-30 17:35:58 +00:00
SomberNight 4aa319e5c3 CI: exclude generated protobuf files from flake8 2023-01-28 00:51:12 +00:00
ghost43 5edd17724f CI: bump available memory for unit tests (1G->2G) (#8166)
Tasks recently started spuriously getting killed with "Container errored with 'OOMKilled'".
Not sure what changed, but this seems like the easiest fix.
2023-01-26 14:47:39 +00:00
SomberNight 1a7634e615 cirrus CI: disable macOS builds, as no more intel-based mac workers
related https://cirrus-ci.org/blog/2022/11/08/sunsetting-intel-macos-instances/
2023-01-02 12:41:22 +00:00
SomberNight feb75ec9e6 CI: AppImage build is failing with "Container errored with 'OOMKilled'"
"AppImage build" on the CI is failing with "Container errored with 'OOMKilled'" since 65ae281180
https://cirrus-ci.com/task/6506466559918080
https://cirrus-ci.com/task/6518283422662656

Apparently, when running in a Cirrus CI container, `nproc` returns the number of host CPUs,
instead of the number of cpus available to the container.
Opened upstream issue:
https://github.com/cirruslabs/cirrus-ci-docs/issues/1115
2022-12-04 00:11:29 +00:00