Skip to content

Commit

Permalink
Merge branch 'auxpow'
Browse files Browse the repository at this point in the history
  • Loading branch information
domob1812 committed Nov 20, 2023
2 parents f324eb4 + 88a6751 commit ea10675
Show file tree
Hide file tree
Showing 189 changed files with 1,247 additions and 958 deletions.
3 changes: 3 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ task:
memory: 1G
# For faster CI feedback, immediately schedule the linters
<< : *CREDITS_TEMPLATE
test_runner_cache:
folder: "/lint_test_runner"
fingerprint_script: echo $CIRRUS_TASK_NAME $(git rev-parse HEAD:test/lint/test_runner)
python_cache:
folder: "/python_build"
fingerprint_script: cat .python-version /etc/os-release
Expand Down
10 changes: 4 additions & 6 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ endif
.PHONY: deploy FORCE
.INTERMEDIATE: $(COVERAGE_INFO)

export PYTHONPATH

if BUILD_BITCOIN_LIBS
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libnamecoinconsensus.pc
Expand Down Expand Up @@ -189,7 +187,7 @@ $(COV_TOOL_WRAPPER):
@chmod +x $(COV_TOOL_WRAPPER)

baseline.info: $(COV_TOOL_WRAPPER)
$(LCOV) -c -i -d $(abs_builddir)/src -o $@
$(LCOV) $(LCOV_OPTS) -c -i -d $(abs_builddir)/src -o $@

baseline_filtered.info: baseline.info
$(abs_builddir)/contrib/filter-lcov.py $(LCOV_FILTER_PATTERN) $< $@
Expand Down Expand Up @@ -223,13 +221,13 @@ functional_test_filtered.info: functional_test.info
$(LCOV) -a $@ $(LCOV_OPTS) -o $@

fuzz_coverage.info: fuzz_filtered.info
$(LCOV) -a $(LCOV_OPTS) baseline_filtered.info -a fuzz_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt
$(LCOV) $(LCOV_OPTS) -a baseline_filtered.info -a fuzz_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt

test_bitcoin_coverage.info: baseline_filtered.info test_bitcoin_filtered.info
$(LCOV) -a $(LCOV_OPTS) baseline_filtered.info -a test_bitcoin_filtered.info -o $@
$(LCOV) $(LCOV_OPTS) -a baseline_filtered.info -a test_bitcoin_filtered.info -o $@

total_coverage.info: test_bitcoin_filtered.info functional_test_filtered.info
$(LCOV) -a $(LCOV_OPTS) baseline_filtered.info -a test_bitcoin_filtered.info -a functional_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt
$(LCOV) $(LCOV_OPTS) -a baseline_filtered.info -a test_bitcoin_filtered.info -a functional_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt

fuzz.coverage/.dirstamp: fuzz_coverage.info
$(GENHTML) -s $(LCOV_OPTS) $< -o $(@D)
Expand Down
6 changes: 4 additions & 2 deletions build-aux/m4/l_atomic.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ dnl permitted in any medium without royalty provided the copyright notice
dnl and this notice are preserved. This file is offered as-is, without any
dnl warranty.

# Some versions of gcc/libstdc++ require linking with -latomic if
# using the C++ atomic library.
# Clang prior to version 15, when building for 32-bit,
# and linking against libstdc++, requires linking with
# -latomic if using the C++ atomic library.
# Can be tested with: clang++ test.cpp -m32
#
# Sourced from http://bugs.debian.org/797228

Expand Down
2 changes: 1 addition & 1 deletion ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ in order.
### Cache

In order to avoid rebuilding all dependencies for each build, the binaries are
cached and re-used when possible. Changes in the dependency-generator will
cached and reused when possible. Changes in the dependency-generator will
trigger cache-invalidation and rebuilds as necessary.
11 changes: 11 additions & 0 deletions ci/lint/04_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ export PATH="${PYTHON_PATH}/bin:${PATH}"
command -v python3
python3 --version

export LINT_RUNNER_PATH="/lint_test_runner"
if [ ! -d "${LINT_RUNNER_PATH}" ]; then
${CI_RETRY_EXE} apt-get install -y cargo
(
cd ./test/lint/test_runner || exit 1
cargo build
mkdir -p "${LINT_RUNNER_PATH}"
mv target/debug/test_runner "${LINT_RUNNER_PATH}"
)
fi

${CI_RETRY_EXE} pip3 install \
codespell==2.2.5 \
flake8==6.1.0 \
Expand Down
1 change: 1 addition & 0 deletions ci/lint/06_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ test/lint/git-subtree-check.sh src/secp256k1
test/lint/git-subtree-check.sh src/minisketch
test/lint/git-subtree-check.sh src/leveldb
test/lint/git-subtree-check.sh src/crc32c
RUST_BACKTRACE=1 "${LINT_RUNNER_PATH}/test_runner"
test/lint/check-doc.py
test/lint/all-lint.py

Expand Down
1 change: 1 addition & 0 deletions ci/lint/container-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export LC_ALL=C
git config --global --add safe.directory /bitcoin

export PATH="/python_build/bin:${PATH}"
export LINT_RUNNER_PATH="/lint_test_runner"

if [ -z "$1" ]; then
LOCAL_BRANCH=1 bash -ic "./ci/lint/06_script.sh"
Expand Down
1 change: 0 additions & 1 deletion ci/test/00_setup_env_mac_native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ export NO_DEPENDS=1
export OSX_SDK=""
export CCACHE_MAXSIZE=400M
export RUN_FUZZ_TESTS=true
export FUZZ_TESTS_CONFIG="--exclude banman" # https://github.com/bitcoin/bitcoin/issues/27924
14 changes: 11 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ AC_PATH_TOOL([OBJCOPY], [objcopy])
AC_PATH_PROG([DOXYGEN], [doxygen])
AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])

AC_ARG_VAR([PYTHONPATH], [Augments the default search path for python module files])

AC_ARG_ENABLE([wallet],
[AS_HELP_STRING([--disable-wallet],
[disable wallet (enabled by default)])],
Expand Down Expand Up @@ -1002,7 +1000,6 @@ dnl "ad_strip" as the symbol for the entry point.
if test "$TARGET_OS" = "darwin"; then
AX_CHECK_LINK_FLAG([-Wl,-dead_strip], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,-dead_strip"], [], [$LDFLAG_WERROR])
AX_CHECK_LINK_FLAG([-Wl,-dead_strip_dylibs], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,-dead_strip_dylibs"], [], [$LDFLAG_WERROR])
AX_CHECK_LINK_FLAG([-Wl,-bind_at_load], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-bind_at_load"], [], [$LDFLAG_WERROR])
AX_CHECK_LINK_FLAG([-Wl,-fixup_chains], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-fixup_chains"], [], [$LDFLAG_WERROR])
fi

Expand Down Expand Up @@ -1970,6 +1967,17 @@ case ${OS} in
;;
esac

dnl An old hack similar to a98356fee to remove hard-coded
dnl bind_at_load flag from libtool
case $host in
*darwin*)
AC_MSG_RESULT([Removing -Wl,bind_at_load from libtool.])
sed < libtool > libtool-2 '/bind_at_load/d'
mv libtool-2 libtool
chmod 755 libtool
;;
esac

echo
echo "Options used to compile and link:"
echo " external signer = $use_external_signer"
Expand Down
5 changes: 2 additions & 3 deletions contrib/devtools/circular-dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import sys
import re
from typing import Dict, List, Set

MAPPING = {
'core_read.cpp': 'core_io.cpp',
Expand Down Expand Up @@ -33,7 +32,7 @@ def module_name(path):
return None

files = dict()
deps: Dict[str, Set[str]] = dict()
deps: dict[str, set[str]] = dict()

RE = re.compile("^#include <(.*)>")

Expand Down Expand Up @@ -65,7 +64,7 @@ def module_name(path):
shortest_cycle = None
for module in sorted(deps.keys()):
# Build the transitive closure of dependencies of module
closure: Dict[str, List[str]] = dict()
closure: dict[str, list[str]] = dict()
for dep in deps[module]:
closure[dep] = []
while True:
Expand Down
3 changes: 1 addition & 2 deletions contrib/devtools/security-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
Otherwise the exit status will be 1 and it will log which executables failed which checks.
'''
import sys
from typing import List

import lief

Expand Down Expand Up @@ -255,7 +254,7 @@ def check_MACHO_control_flow(binary) -> bool:
retval = 1
continue

failed: List[str] = []
failed: list[str] = []
for (name, func) in CHECKS[etype][arch]:
if not func(binary):
failed.append(name)
Expand Down
7 changes: 3 additions & 4 deletions contrib/devtools/symbol-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
find ../path/to/binaries -type f -executable | xargs python3 contrib/devtools/symbol-check.py
'''
import sys
from typing import List, Dict

import lief

Expand Down Expand Up @@ -53,7 +52,7 @@

# Expected linker-loader names can be found here:
# https://sourceware.org/glibc/wiki/ABIList?action=recall&rev=16
ELF_INTERPRETER_NAMES: Dict[lief.ELF.ARCH, Dict[lief.ENDIANNESS, str]] = {
ELF_INTERPRETER_NAMES: dict[lief.ELF.ARCH, dict[lief.ENDIANNESS, str]] = {
lief.ELF.ARCH.x86_64: {
lief.ENDIANNESS.LITTLE: "/lib64/ld-linux-x86-64.so.2",
},
Expand All @@ -72,7 +71,7 @@
},
}

ELF_ABIS: Dict[lief.ELF.ARCH, Dict[lief.ENDIANNESS, List[int]]] = {
ELF_ABIS: dict[lief.ELF.ARCH, dict[lief.ENDIANNESS, list[int]]] = {
lief.ELF.ARCH.x86_64: {
lief.ENDIANNESS.LITTLE: [3,2,0],
},
Expand Down Expand Up @@ -302,7 +301,7 @@ def check_ELF_ABI(binary) -> bool:
retval = 1
continue

failed: List[str] = []
failed: list[str] = []
for (name, func) in CHECKS[etype]:
if not func(binary):
failed.append(name)
Expand Down
11 changes: 5 additions & 6 deletions contrib/devtools/test-security-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import lief
import os
import subprocess
from typing import List
import unittest

from utils import determine_wellknown_cmd
Expand All @@ -34,7 +33,7 @@ def call_security_check(cc: str, source: str, executable: str, options) -> tuple
#
# See the definitions for ac_link in autoconf's lib/autoconf/c.m4 file for
# reference.
env_flags: List[str] = []
env_flags: list[str] = []
for var in ['CFLAGS', 'CPPFLAGS', 'LDFLAGS']:
env_flags += filter(None, os.environ.get(var, '').split(' '))

Expand Down Expand Up @@ -129,11 +128,11 @@ def test_MACHO(self):
(1, executable+': failed NOUNDEFS PIE CONTROL_FLOW'))
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-fstack-protector-all', '-Wl,-fixup_chains']),
(1, executable+': failed PIE CONTROL_FLOW'))
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-bind_at_load','-fstack-protector-all', '-Wl,-fixup_chains']),
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-fstack-protector-all', '-Wl,-fixup_chains']),
(1, executable+': failed PIE CONTROL_FLOW'))
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-bind_at_load','-fstack-protector-all', '-fcf-protection=full', '-Wl,-fixup_chains']),
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-fstack-protector-all', '-fcf-protection=full', '-Wl,-fixup_chains']),
(1, executable+': failed PIE'))
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-pie','-Wl,-bind_at_load','-fstack-protector-all', '-fcf-protection=full', '-Wl,-fixup_chains']),
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-pie','-fstack-protector-all', '-fcf-protection=full', '-Wl,-fixup_chains']),
(0, ''))
else:
# arm64 darwin doesn't support non-PIE binaries, control flow or executable stacks
Expand All @@ -143,7 +142,7 @@ def test_MACHO(self):
(1, executable+': failed NOUNDEFS Canary'))
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-flat_namespace','-fstack-protector-all', '-Wl,-fixup_chains']),
(1, executable+': failed NOUNDEFS'))
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-bind_at_load','-fstack-protector-all', '-Wl,-fixup_chains']),
self.assertEqual(call_security_check(cc, source, executable, ['-fstack-protector-all', '-Wl,-fixup_chains']),
(0, ''))


Expand Down
7 changes: 3 additions & 4 deletions contrib/devtools/test-symbol-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@
'''
import os
import subprocess
from typing import List
import unittest

from utils import determine_wellknown_cmd

def call_symbol_check(cc: List[str], source, executable, options):
def call_symbol_check(cc: list[str], source, executable, options):
# This should behave the same as AC_TRY_LINK, so arrange well-known flags
# in the same order as autoconf would.
#
# See the definitions for ac_link in autoconf's lib/autoconf/c.m4 file for
# reference.
env_flags: List[str] = []
env_flags: list[str] = []
for var in ['CFLAGS', 'CPPFLAGS', 'LDFLAGS']:
env_flags += filter(None, os.environ.get(var, '').split(' '))

Expand All @@ -28,7 +27,7 @@ def call_symbol_check(cc: List[str], source, executable, options):
os.remove(executable)
return (p.returncode, p.stdout.rstrip())

def get_machine(cc: List[str]):
def get_machine(cc: list[str]):
p = subprocess.run([*cc,'-dumpmachine'], stdout=subprocess.PIPE, text=True)
return p.stdout.rstrip()

Expand Down
3 changes: 1 addition & 2 deletions contrib/devtools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
import shutil
import sys
import os
from typing import List


def determine_wellknown_cmd(envvar, progname) -> List[str]:
def determine_wellknown_cmd(envvar, progname) -> list[str]:
maybe_env = os.getenv(envvar)
maybe_which = shutil.which(progname)
if maybe_env:
Expand Down
5 changes: 1 addition & 4 deletions contrib/guix/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,7 @@ git clone https://git.savannah.gnu.org/git/guix.git
cd guix
```

You will likely want to build the latest release, however, if the latest release
when you're reading this is still 1.3.0 then you may want to use 998eda30 instead
to avoid the issues described in [#25099](
https://github.com/bitcoin/bitcoin/pull/25099).
You will likely want to build the latest release.

```
git branch -a -l 'origin/version-*' # check for the latest release
Expand Down
2 changes: 1 addition & 1 deletion contrib/guix/libexec/prelude.bash
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fi
time-machine() {
# shellcheck disable=SC2086
guix time-machine --url=https://git.savannah.gnu.org/git/guix.git \
--commit=160f78a4d92205df986ed9efcce7d3aac188cb24 \
--commit=77386bdbfe6b0c649c05ab37f08051d1ab3e5074 \
--cores="$JOBS" \
--keep-failed \
--fallback \
Expand Down
Loading

0 comments on commit ea10675

Please sign in to comment.