Skip to content

Commit 75610e9

Browse files
Merge #6987: chore: merge bitcoin#28347, partial bitcoin#30527, bitcoin#26257, bump to Python 3.10, mypy 0.981, fix Docker group assignment, minor housekeeping (misc. changes: part 2)
82723dc fix: don't forget to assign user to group if group exists (Kittywhiskers Van Gogh) 066d409 chore: remove outdated `boot2docker` comment (Kittywhiskers Van Gogh) 29e98e3 chore: document `USER_ID` and `GROUP_ID` in `docker-compose.yml` (Kittywhiskers Van Gogh) 6ea897a chore: drop unmaintained Guix container (Kittywhiskers Van Gogh) 6a1786c fix: resolve `test: =: unary operator expected` error (Kittywhiskers Van Gogh) d6489f0 fix: make copy of `skip` in `GetStackFrames` to avoid clobbering (Kittywhiskers Van Gogh) 4110ff3 lint: mypy 0.981 (Kittywhiskers Van Gogh) 80a44e9 partial bitcoin#26257: python linter flake8 E275 fixup, update dependencies (Kittywhiskers Van Gogh) 7b80dfb merge bitcoin#28347: replace deprecated pkg_resources with importlib.metadata (Kittywhiskers Van Gogh) 04ac20a partial bitcoin#30527: Bump python minimum supported version to 3.10 (Kittywhiskers Van Gogh) Pull request description: ## Additional Information * Dependency for #6988 * Python 3.9's security support elapsed on 31st Oct '25 ([source](https://endoflife.date/python)), in response to that we are switching over to Python 3.10. * Due to [python/mypy#13627](python/mypy#13627) arising as a result of this bump, we also had to upgrade `mypy` to 0.981. Note that this is a divergence from upstream as they opted to upgrade to `mypy` 1.x (see [bitcoin#28009](bitcoin#28009)) but the changes needed to do so are too disruptive given this PR's larger context. Future backports should feel free to overwrite the mypy version and realign with upstream. * CI identified potential clobbering ([build](https://github.com/kwvg/dash/actions/runs/19434684086/job/55606106842#step:8:1804)) in Windows stacktraces code that started to build after [dash#6966](#6966) (see below). Additionally, C++20 has deprecated certain operators like {in,de}crementation courtesy of [P1152](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1152r3.html), which required additional adaptation. <details> <summary>Build error:</summary> ``` stacktraces.cpp: In function ‘std::vector<long long unsigned int> GetStackFrames(size_t, size_t, const CONTEXT*)’: stacktraces.cpp:167:56: error: variable ‘skip’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered] 167 | static __attribute__((noinline)) std::vector<uint64_t> GetStackFrames(size_t skip, size_t max_frames, const CONTEXT* pContext = nullptr) | ^~~~~~~~~~~~~~ cc1plus: all warnings being treated as errors ``` </details> * The `AM_CONDITIONAL` for `CRASH_HOOKS_WRAPPED_CXX_ABI` wasn't evaluated due to missing quotations (see below), this has been resolved. <details> <summary>Configure:</summary> ``` checking whether the linker accepts -Wl,-export-dynamic... no checking whether the linker accepts -rdynamic... yes checking whether C++ compiler accepts -gdwarf-4... yes checking whether C++ compiler accepts -fno-standalone-debug... yes checking whether the linker accepts -Wl,-wrap=__cxa_allocate_exception... no ./configure: line 30603: test: =: unary operator expected checking for Linux getrandom syscall... no checking for getentropy via random.h... yes checking for sysctl... yes checking for sysctl KERN_ARND... no checking for fdatasync... no ``` </details> * Currently we offer two containers for Guix builds meant for developers who aren't on Linux, one was introduced by [dash#5285](#5285) (based on [fanquake/core-review](https://github.com/fanquake/core-review)'s container, [source](https://github.com/fanquake/core-review/blob/d8cf188214879ea1b095e2ba34ca5c23dbc3ebd2/guix/imagefile)) and the other introduced by [dash#5449](#5449), the former does not seem to get much use and has been out of sync with its upstream source for a while. As the second container is used by some developers and is updated and maintained to fit Dash's specific needs, the first container has been dropped and documentation has been updated to reflect the same. * As Docker has matured with the WSL2 backend on Windows and the Apple Virtualization framework on macOS, boot2docker has been deprecated (see [boot2docker/boot2docker#1408](boot2docker/boot2docker#1408)) and the comment referencing it has been dropped. * To avoid permissions issues with mounting directories, containers come with `USER_ID` and `GROUP_ID` args ([source](https://github.com/dashpay/dash/blob/23de96916a8b8f97a2c408bb76da1d2149d7227c/contrib/containers/ci/ci-slim.Dockerfile#L123-L131)) that need to be specified at build time if the mount needs different permissions (as is often the case on macOS). To make that option more explicitly clear, it has been specified in `docker-compose.yml` with default values filled in. * [dash#6929](#6929) introduced a fix to prevent unexpected container build failure due to conflicting groups (most commonly GID 20 that on macOS is `staff` but on Linux is `dialout`) but the fix did _not_ assign the default user to that group, that has been resolved here. ## Breaking Changes None expected. ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have added or updated relevant unit/integration/functional/e2e tests - [x] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK 82723dc ~with one nit~ Tree-SHA512: 0e906d1a7fea9edc52a40a6a6971fa6b2599674e97e99c65a220f99cc44be78f4290be8fb9af7782cac416bcdd2338b7f17a5c50b5fdcf727b1cf84fe44c8686
2 parents 695ce12 + 82723dc commit 75610e9

File tree

10 files changed

+26
-94
lines changed

10 files changed

+26
-94
lines changed

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.9.18
1+
3.10.14

ci/lint/04_install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ fi
3636
${CI_RETRY_EXE} pip3 install codespell==2.1.0
3737
${CI_RETRY_EXE} pip3 install flake8==4.0.1
3838
${CI_RETRY_EXE} pip3 install lief==0.13.1
39-
${CI_RETRY_EXE} pip3 install mypy==0.942
40-
${CI_RETRY_EXE} pip3 install pyzmq==22.3.0
41-
${CI_RETRY_EXE} pip3 install vulture==2.3
39+
${CI_RETRY_EXE} pip3 install mypy==0.981
40+
${CI_RETRY_EXE} pip3 install pyzmq==24.0.1
41+
${CI_RETRY_EXE} pip3 install vulture==2.6
4242

4343
SHELLCHECK_VERSION=v0.8.0
4444
curl -sL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | \

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,7 @@ if test "$enable_crashhooks" = "yes"; then
12721272
fi
12731273

12741274
AX_CHECK_LINK_FLAG([-Wl,-wrap=__cxa_allocate_exception], [LINK_WRAP_SUPPORTED=yes],,,)
1275-
AM_CONDITIONAL([CRASH_HOOKS_WRAPPED_CXX_ABI],[test $LINK_WRAP_SUPPORTED = "yes"])
1275+
AM_CONDITIONAL([CRASH_HOOKS_WRAPPED_CXX_ABI],[test "$LINK_WRAP_SUPPORTED" = "yes"])
12761276

12771277
if test "$LINK_WRAP_SUPPORTED" = "yes"; then
12781278
AC_DEFINE(CRASH_HOOKS_WRAPPED_CXX_ABI, 1, [Define this symbol to use wrapped CXX ABIs for exception stacktraces])

contrib/containers/ci/ci-slim.Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
5555

5656
# Install Python to a system-wide location and set it as default
5757
# PYTHON_VERSION should match the value in .python-version
58-
ARG PYTHON_VERSION=3.9.18
58+
ARG PYTHON_VERSION=3.10.14
5959
ENV UV_PYTHON_INSTALL_DIR=/usr/local/python
6060
RUN uv python install ${PYTHON_VERSION}
6161

@@ -78,9 +78,9 @@ RUN uv pip install --system --break-system-packages \
7878
jinja2 \
7979
lief==0.13.2 \
8080
multiprocess \
81-
mypy==0.942 \
82-
pyzmq==22.3.0 \
83-
vulture==2.3
81+
mypy==0.981 \
82+
pyzmq==24.0.1 \
83+
vulture==2.6
8484

8585
# Install packages relied on by tests
8686
ARG DASH_HASH_VERSION=1.4.0
@@ -123,7 +123,7 @@ RUN set -ex; \
123123
ARG USER_ID=1000 \
124124
GROUP_ID=1000
125125
RUN set -ex; \
126-
getent group ${GROUP_ID} || groupmod -g ${GROUP_ID} -n dash ubuntu; \
126+
(getent group ${GROUP_ID} && usermod -g ${GROUP_ID} ubuntu) || groupmod -g ${GROUP_ID} -n dash ubuntu; \
127127
usermod -u ${USER_ID} -md /home/dash -l dash ubuntu; \
128128
chown ${USER_ID}:${GROUP_ID} -R /home/dash; \
129129
mkdir -p /src/dash && \

contrib/containers/develop/docker-compose.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ services:
44
build:
55
context: '..'
66
dockerfile: './develop/Dockerfile'
7+
args:
8+
USER_ID: 1000 # set this to $(id -u) of the host
9+
GROUP_ID: 1000 # set this to $(id -g) of the host
710
ports:
811
- "9998:9998" # Mainnet Ports
912
- "9999:9999"
@@ -13,19 +16,8 @@ services:
1316
- seccomp:unconfined
1417
stdin_open: true # Equivalent to -i
1518
tty: true # Equivalent to -t
16-
17-
# A note about volumes:
18-
#
19-
# If Docker is interacting with your operating system directly
20-
# without an intermediate VM, then you do not need to change anything
21-
#
22-
# But if not, then you'll need to mount your system's root directory
23-
# (i.e. /) into the boot2docker instance if you want to mirror the exact
24-
# filesystem structure of your host.
25-
#
2619
volumes:
2720
- type: bind
28-
# source: /host/$PWD # Workaround needed on non-Linux hosts
2921
source: ../../..
3022
target: /src/dash
3123

contrib/guix/Dockerfile

Lines changed: 0 additions & 63 deletions
This file was deleted.

contrib/guix/INSTALL.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Otherwise, you may choose from one of the following options to install Guix:
1919
- Installs any release
2020
- Binary installation only, requires high level of trust
2121
3. Using **Docker image** [↗︎ external instructions][install-docker]
22-
- Maintained by pastapastapasta
2322
- Easy (automatically performs *some* setup)
2423
- Works wherever Docker images work
2524
- Installs any release
@@ -59,8 +58,8 @@ so you should log out and log back in.
5958

6059
## Option 3: Using Docker image
6160

62-
Please refer to Docker's image
63-
[here](https://github.com/dashpay/dash/tree/master/contrib/guix/Dockerfile).
61+
Please refer to Docker image
62+
[here](https://github.com/dashpay/dash/tree/master/contrib/containers/guix/Dockerfile).
6463

6564
## Option 4: Using a distribution-maintained package
6665

doc/dependencies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ You can find installation instructions in the `build-*.md` file for your platfor
1010
| [Automake](https://www.gnu.org/software/automake/) | [1.13](https://github.com/bitcoin/bitcoin/pull/18290) |
1111
| [Clang](https://clang.llvm.org) | [16.0](https://github.com/bitcoin/bitcoin/pull/30263) |
1212
| [GCC](https://gcc.gnu.org) | [11.1](https://github.com/bitcoin/bitcoin/pull/29091) |
13-
| [Python](https://www.python.org) (scripts, tests) | [3.9](https://github.com/bitcoin/bitcoin/pull/28211) |
13+
| [Python](https://www.python.org) (scripts, tests) | [3.10](https://github.com/bitcoin/bitcoin/pull/30527) |
1414
| [systemtap](https://sourceware.org/systemtap/) ([tracing](tracing.md))| N/A |
1515

1616
## Required

src/stacktraces.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ static uint64_t ConvertAddress(uint64_t addr)
167167
static __attribute__((noinline)) std::vector<uint64_t> GetStackFrames(size_t skip, size_t max_frames, const CONTEXT* pContext = nullptr)
168168
{
169169
#ifdef ENABLE_STACKTRACES
170+
volatile size_t skip_frames = skip;
171+
170172
// We can't use libbacktrace for stack unwinding on Windows as it returns invalid addresses (like 0x1 or 0xffffffff)
171173
// dbghelp is not thread safe
172174
static StdMutex m;
@@ -205,7 +207,7 @@ static __attribute__((noinline)) std::vector<uint64_t> GetStackFrames(size_t ski
205207
stackframe.AddrStack.Offset = context.Rsp;
206208
stackframe.AddrStack.Mode = AddrModeFlat;
207209
if (!pContext) {
208-
skip++; // skip this method
210+
skip_frames = skip_frames + 1; // skip this method
209211
}
210212
#else
211213
#error unsupported architecture
@@ -223,7 +225,7 @@ static __attribute__((noinline)) std::vector<uint64_t> GetStackFrames(size_t ski
223225
if (!result) {
224226
break;
225227
}
226-
if (i >= skip) {
228+
if (i >= skip_frames) {
227229
uint64_t pc = ConvertAddress(stackframe.AddrPC.Offset);
228230
if (pc == 0) {
229231
pc = stackframe.AddrPC.Offset;

test/lint/lint-python.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
"""
1010

1111
import os
12-
import pkg_resources
1312
import subprocess
1413
import sys
1514

15+
from importlib.metadata import metadata, PackageNotFoundError
16+
17+
1618
DEPS = ['flake8', 'lief', 'mypy', 'pyzmq']
1719
MYPY_CACHE_DIR = f"{os.getenv('BASE_ROOT_DIR', '')}/test/.mypy_cache"
1820
FILES_ARGS = ['git', 'ls-files', '--','test/functional/*.py', 'contrib/devtools/*.py', ':(exclude)contrib/devtools/github-merge.py']
@@ -95,10 +97,10 @@
9597

9698

9799
def check_dependencies():
98-
working_set = {pkg.key for pkg in pkg_resources.working_set}
99-
100100
for dep in DEPS:
101-
if dep not in working_set:
101+
try:
102+
metadata(dep)
103+
except PackageNotFoundError:
102104
print(f"Skipping Python linting since {dep} is not installed.")
103105
exit(0)
104106

0 commit comments

Comments
 (0)