diff --git a/.python-version b/.python-version index 43077b246094f..1445aee866ce6 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -3.9.18 +3.10.14 diff --git a/ci/lint/04_install.sh b/ci/lint/04_install.sh index f70ff2d2235e4..0453e91674881 100755 --- a/ci/lint/04_install.sh +++ b/ci/lint/04_install.sh @@ -36,9 +36,9 @@ fi ${CI_RETRY_EXE} pip3 install codespell==2.1.0 ${CI_RETRY_EXE} pip3 install flake8==4.0.1 ${CI_RETRY_EXE} pip3 install lief==0.13.1 -${CI_RETRY_EXE} pip3 install mypy==0.942 -${CI_RETRY_EXE} pip3 install pyzmq==22.3.0 -${CI_RETRY_EXE} pip3 install vulture==2.3 +${CI_RETRY_EXE} pip3 install mypy==0.981 +${CI_RETRY_EXE} pip3 install pyzmq==24.0.1 +${CI_RETRY_EXE} pip3 install vulture==2.6 SHELLCHECK_VERSION=v0.8.0 curl -sL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | \ diff --git a/configure.ac b/configure.ac index f4fa99953b1cf..6eccd119c8400 100644 --- a/configure.ac +++ b/configure.ac @@ -1272,7 +1272,7 @@ if test "$enable_crashhooks" = "yes"; then fi AX_CHECK_LINK_FLAG([-Wl,-wrap=__cxa_allocate_exception], [LINK_WRAP_SUPPORTED=yes],,,) -AM_CONDITIONAL([CRASH_HOOKS_WRAPPED_CXX_ABI],[test $LINK_WRAP_SUPPORTED = "yes"]) +AM_CONDITIONAL([CRASH_HOOKS_WRAPPED_CXX_ABI],[test "$LINK_WRAP_SUPPORTED" = "yes"]) if test "$LINK_WRAP_SUPPORTED" = "yes"; then AC_DEFINE(CRASH_HOOKS_WRAPPED_CXX_ABI, 1, [Define this symbol to use wrapped CXX ABIs for exception stacktraces]) diff --git a/contrib/containers/ci/ci-slim.Dockerfile b/contrib/containers/ci/ci-slim.Dockerfile index ae59495f3981e..09843ccc34dbf 100644 --- a/contrib/containers/ci/ci-slim.Dockerfile +++ b/contrib/containers/ci/ci-slim.Dockerfile @@ -55,7 +55,7 @@ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ # Install Python to a system-wide location and set it as default # PYTHON_VERSION should match the value in .python-version -ARG PYTHON_VERSION=3.9.18 +ARG PYTHON_VERSION=3.10.14 ENV UV_PYTHON_INSTALL_DIR=/usr/local/python RUN uv python install ${PYTHON_VERSION} @@ -78,9 +78,9 @@ RUN uv pip install --system --break-system-packages \ jinja2 \ lief==0.13.2 \ multiprocess \ - mypy==0.942 \ - pyzmq==22.3.0 \ - vulture==2.3 + mypy==0.981 \ + pyzmq==24.0.1 \ + vulture==2.6 # Install packages relied on by tests ARG DASH_HASH_VERSION=1.4.0 @@ -123,7 +123,7 @@ RUN set -ex; \ ARG USER_ID=1000 \ GROUP_ID=1000 RUN set -ex; \ - getent group ${GROUP_ID} || groupmod -g ${GROUP_ID} -n dash ubuntu; \ + (getent group ${GROUP_ID} && usermod -g ${GROUP_ID} ubuntu) || groupmod -g ${GROUP_ID} -n dash ubuntu; \ usermod -u ${USER_ID} -md /home/dash -l dash ubuntu; \ chown ${USER_ID}:${GROUP_ID} -R /home/dash; \ mkdir -p /src/dash && \ diff --git a/contrib/containers/develop/docker-compose.yml b/contrib/containers/develop/docker-compose.yml index 9238c97183e79..c6f2cea704243 100644 --- a/contrib/containers/develop/docker-compose.yml +++ b/contrib/containers/develop/docker-compose.yml @@ -4,6 +4,9 @@ services: build: context: '..' dockerfile: './develop/Dockerfile' + args: + USER_ID: 1000 # set this to $(id -u) of the host + GROUP_ID: 1000 # set this to $(id -g) of the host ports: - "9998:9998" # Mainnet Ports - "9999:9999" @@ -13,19 +16,8 @@ services: - seccomp:unconfined stdin_open: true # Equivalent to -i tty: true # Equivalent to -t - -# A note about volumes: -# -# If Docker is interacting with your operating system directly -# without an intermediate VM, then you do not need to change anything -# -# But if not, then you'll need to mount your system's root directory -# (i.e. /) into the boot2docker instance if you want to mirror the exact -# filesystem structure of your host. -# volumes: - type: bind -# source: /host/$PWD # Workaround needed on non-Linux hosts source: ../../.. target: /src/dash diff --git a/contrib/guix/Dockerfile b/contrib/guix/Dockerfile deleted file mode 100644 index bffb10f75c48d..0000000000000 --- a/contrib/guix/Dockerfile +++ /dev/null @@ -1,63 +0,0 @@ -FROM alpine:3.17 - -RUN apk --no-cache --update add \ - bash \ - bzip2 \ - ca-certificates \ - curl \ - git \ - make \ - shadow - -ARG guix_download_path=ftp://ftp.gnu.org/gnu/guix -ARG guix_version=1.4.0 -ARG guix_checksum_aarch64=72d807392889919940b7ec9632c45a259555e6b0942ea7bfd131101e08ebfcf4 -ARG guix_checksum_x86_64=236ca7c9c5958b1f396c2924fcc5bc9d6fdebcb1b4cf3c7c6d46d4bf660ed9c9 -ARG builder_count=32 - -ENV PATH="/root/.config/guix/current/bin:$PATH" - -# Application Setup -# https://guix.gnu.org/manual/en/html_node/Application-Setup.html -ENV GUIX_LOCPATH="/root/.guix-profile/lib/locale" -ENV LC_ALL="en_US.UTF-8" - -RUN guix_file_name=guix-binary-${guix_version}.$(uname -m)-linux.tar.xz && \ - eval "guix_checksum=\${guix_checksum_$(uname -m)}" && \ - cd /tmp && \ - wget -q -O "$guix_file_name" "${guix_download_path}/${guix_file_name}" && \ - echo "${guix_checksum} ${guix_file_name}" | sha256sum -c && \ - tar xJf "$guix_file_name" && \ - mv var/guix /var/ && \ - mv gnu / && \ - mkdir -p ~root/.config/guix && \ - ln -sf /var/guix/profiles/per-user/root/current-guix ~root/.config/guix/current && \ - source ~root/.config/guix/current/etc/profile - -# Guix expects this file to exist -RUN touch /etc/nsswitch.conf - -RUN guix archive --authorize < ~root/.config/guix/current/share/guix/ci.guix.gnu.org.pub - -# Build Environment Setup -# https://guix.gnu.org/manual/en/html_node/Build-Environment-Setup.html - -RUN groupadd --system guixbuild -RUN for i in $(seq -w 1 ${builder_count}); do \ - useradd -g guixbuild -G guixbuild \ - -d /var/empty -s $(which nologin) \ - -c "Guix build user ${i}" --system \ - "guixbuilder${i}" ; \ - done - -ENTRYPOINT ["/root/.config/guix/current/bin/guix-daemon","--build-users-group=guixbuild"] - -RUN git clone https://github.com/dashpay/dash.git /dash - -RUN mkdir base_cache sources SDKs - -WORKDIR /dash - -RUN mkdir -p depends/SDKs && \ - curl -L https://bitcoincore.org/depends-sources/sdks/Xcode-15.0-15A240d-extracted-SDK-with-libcxx-headers.tar.gz | tar -xz -C depends/SDKs - diff --git a/contrib/guix/INSTALL.md b/contrib/guix/INSTALL.md index d96e71edf218c..b347c83508584 100644 --- a/contrib/guix/INSTALL.md +++ b/contrib/guix/INSTALL.md @@ -19,7 +19,6 @@ Otherwise, you may choose from one of the following options to install Guix: - Installs any release - Binary installation only, requires high level of trust 3. Using **Docker image** [↗︎ external instructions][install-docker] - - Maintained by pastapastapasta - Easy (automatically performs *some* setup) - Works wherever Docker images work - Installs any release @@ -59,8 +58,8 @@ so you should log out and log back in. ## Option 3: Using Docker image -Please refer to Docker's image -[here](https://github.com/dashpay/dash/tree/master/contrib/guix/Dockerfile). +Please refer to Docker image +[here](https://github.com/dashpay/dash/tree/master/contrib/containers/guix/Dockerfile). ## Option 4: Using a distribution-maintained package diff --git a/doc/dependencies.md b/doc/dependencies.md index 6a55eaba416e1..2a2b7ec283705 100644 --- a/doc/dependencies.md +++ b/doc/dependencies.md @@ -10,7 +10,7 @@ You can find installation instructions in the `build-*.md` file for your platfor | [Automake](https://www.gnu.org/software/automake/) | [1.13](https://github.com/bitcoin/bitcoin/pull/18290) | | [Clang](https://clang.llvm.org) | [16.0](https://github.com/bitcoin/bitcoin/pull/30263) | | [GCC](https://gcc.gnu.org) | [11.1](https://github.com/bitcoin/bitcoin/pull/29091) | -| [Python](https://www.python.org) (scripts, tests) | [3.9](https://github.com/bitcoin/bitcoin/pull/28211) | +| [Python](https://www.python.org) (scripts, tests) | [3.10](https://github.com/bitcoin/bitcoin/pull/30527) | | [systemtap](https://sourceware.org/systemtap/) ([tracing](tracing.md))| N/A | ## Required diff --git a/src/stacktraces.cpp b/src/stacktraces.cpp index 26283eb231097..f1d68f27dbc28 100644 --- a/src/stacktraces.cpp +++ b/src/stacktraces.cpp @@ -167,6 +167,8 @@ static uint64_t ConvertAddress(uint64_t addr) static __attribute__((noinline)) std::vector GetStackFrames(size_t skip, size_t max_frames, const CONTEXT* pContext = nullptr) { #ifdef ENABLE_STACKTRACES + volatile size_t skip_frames = skip; + // We can't use libbacktrace for stack unwinding on Windows as it returns invalid addresses (like 0x1 or 0xffffffff) // dbghelp is not thread safe static StdMutex m; @@ -205,7 +207,7 @@ static __attribute__((noinline)) std::vector GetStackFrames(size_t ski stackframe.AddrStack.Offset = context.Rsp; stackframe.AddrStack.Mode = AddrModeFlat; if (!pContext) { - skip++; // skip this method + skip_frames = skip_frames + 1; // skip this method } #else #error unsupported architecture @@ -223,7 +225,7 @@ static __attribute__((noinline)) std::vector GetStackFrames(size_t ski if (!result) { break; } - if (i >= skip) { + if (i >= skip_frames) { uint64_t pc = ConvertAddress(stackframe.AddrPC.Offset); if (pc == 0) { pc = stackframe.AddrPC.Offset; diff --git a/test/lint/lint-python.py b/test/lint/lint-python.py index 574cb65cc05e8..fb6224b06e8a6 100755 --- a/test/lint/lint-python.py +++ b/test/lint/lint-python.py @@ -9,10 +9,12 @@ """ import os -import pkg_resources import subprocess import sys +from importlib.metadata import metadata, PackageNotFoundError + + DEPS = ['flake8', 'lief', 'mypy', 'pyzmq'] MYPY_CACHE_DIR = f"{os.getenv('BASE_ROOT_DIR', '')}/test/.mypy_cache" FILES_ARGS = ['git', 'ls-files', '--','test/functional/*.py', 'contrib/devtools/*.py', ':(exclude)contrib/devtools/github-merge.py'] @@ -95,10 +97,10 @@ def check_dependencies(): - working_set = {pkg.key for pkg in pkg_resources.working_set} - for dep in DEPS: - if dep not in working_set: + try: + metadata(dep) + except PackageNotFoundError: print(f"Skipping Python linting since {dep} is not installed.") exit(0)