Skip to content

Commit 3c9c99e

Browse files
committed
Merge branch 'auxpow'
2 parents 1b283f6 + 92a2e17 commit 3c9c99e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+649
-278
lines changed

.cirrus.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
env: # Global defaults
22
CIRRUS_CLONE_DEPTH: 1
3-
PACKAGE_MANAGER_INSTALL: "apt-get update && apt-get install -y"
3+
CIRRUS_LOG_TIMESTAMP: true
44
MAKEJOBS: "-j10"
55
TEST_RUNNER_PORT_MIN: "14000" # Must be larger than 12321, which is used for the http cache. See https://cirrus-ci.org/guide/writing-tasks/#http-cache
66
CI_FAILFAST_TEST_LEAVE_DANGLING: "1" # Cirrus CI does not care about dangling processes and setting this variable avoids killing the CI script itself on error
@@ -13,9 +13,9 @@ env: # Global defaults
1313
# Generally, a persistent worker must run Ubuntu 23.04+ or Debian 12+.
1414
#
1515
# The following specific types should exist, with the following requirements:
16-
# - small: For an x86_64 machine, recommended to have 2 CPUs and 8 GB of memory.
17-
# - medium: For an x86_64 machine, recommended to have 4 CPUs and 16 GB of memory.
18-
# - arm64: For an aarch64 machine, recommended to have 2 CPUs and 8 GB of memory.
16+
# - small: For an x86_64 machine, with at least 2 vCPUs and 8 GB of memory.
17+
# - medium: For an x86_64 machine, with at least 4 vCPUs and 16 GB of memory.
18+
# - arm64: For an aarch64 machine, with at least 2 vCPUs and 8 GB of memory.
1919
#
2020
# CI jobs for the latter configuration can be run on x86_64 hardware
2121
# by installing qemu-user-static, which works out of the box with
@@ -36,14 +36,13 @@ env: # Global defaults
3636
# This requires installing Podman instead of Docker.
3737
#
3838
# Futhermore:
39-
# - apt-get is required due to PACKAGE_MANAGER_INSTALL
4039
# - podman-docker-4.1+ is required due to the bugfix in 4.1
4140
# (https://github.com/bitcoin/bitcoin/pull/21652#issuecomment-1657098200)
4241
# - The ./ci/ dependencies (with cirrus-cli) should be installed. One-liner example
4342
# for a single user setup with sudo permission:
4443
#
4544
# ```
46-
# apt update && apt install git screen python3 bash podman-docker curl -y && curl -L -o cirrus "https://github.com/cirruslabs/cirrus-cli/releases/latest/download/cirrus-linux-$(dpkg --print-architecture)" && mv cirrus /usr/local/bin/cirrus && chmod +x /usr/local/bin/cirrus
45+
# apt update && apt install git screen python3 bash podman-docker uidmap slirp4netns curl -y && curl -L -o cirrus "https://github.com/cirruslabs/cirrus-cli/releases/latest/download/cirrus-linux-$(dpkg --print-architecture)" && mv cirrus /usr/local/bin/cirrus && chmod +x /usr/local/bin/cirrus
4746
# ```
4847
#
4948
# - There are no strict requirements on the hardware. Having fewer CPU threads
@@ -72,8 +71,8 @@ filter_template: &FILTER_TEMPLATE
7271
base_template: &BASE_TEMPLATE
7372
<< : *FILTER_TEMPLATE
7473
merge_base_script:
75-
# Unconditionally install git (used in fingerprint_script).
76-
- git --version || bash -c "$PACKAGE_MANAGER_INSTALL git"
74+
# Require git (used in fingerprint_script).
75+
- git --version || ( apt-get update && apt-get install -y git )
7776
- if [ "$CIRRUS_PR" = "" ]; then exit 0; fi
7877
- git fetch --depth=1 $CIRRUS_REPO_CLONE_URL "pull/${CIRRUS_PR}/merge"
7978
- git checkout FETCH_HEAD # Use merged changes to detect silent merge conflicts

ci/test/00_setup_env_native_fuzz_with_valgrind.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ export BITCOIN_CONFIG="\
2121
-DCMAKE_C_COMPILER=clang-16 \
2222
-DCMAKE_CXX_COMPILER=clang++-16 \
2323
"
24+
export LLVM_SYMBOLIZER_PATH="/usr/bin/llvm-symbolizer-16"

depends/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ The following can be set when running make: `make FOO=bar`
115115
- `NO_UPNP`: Don't download/build/cache packages needed for enabling UPnP
116116
- `NO_NATPMP`: Don't download/build/cache packages needed for enabling NAT-PMP
117117
- `NO_USDT`: Don't download/build/cache packages needed for enabling USDT tracepoints
118-
- `MULTIPROCESS`: Build libmultiprocess (experimental, requires CMake)
118+
- `MULTIPROCESS`: Build libmultiprocess (experimental)
119119
- `DEBUG`: Disable some optimizations and enable more runtime checking
120120
- `HOST_ID_SALT`: Optional salt to use when generating host package ids
121121
- `BUILD_ID_SALT`: Optional salt to use when generating build package ids

depends/packages/capnp.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ define $(package)_set_vars :=
99
$(package)_config_opts := -DBUILD_TESTING=OFF
1010
$(package)_config_opts += -DWITH_OPENSSL=OFF
1111
$(package)_config_opts += -DWITH_ZLIB=OFF
12+
$(package)_cxxflags += -ffile-prefix-map=$$($(package)_extract_dir)=/usr
1213
endef
1314

1415
define $(package)_config_cmds

depends/packages/libmultiprocess.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ ifneq ($(host),$(build))
1313
$(package)_config_opts := -DCAPNP_EXECUTABLE="$$(native_capnp_prefixbin)/capnp"
1414
$(package)_config_opts += -DCAPNPC_CXX_EXECUTABLE="$$(native_capnp_prefixbin)/capnpc-c++"
1515
endif
16+
$(package)_cxxflags += -ffile-prefix-map=$$($(package)_extract_dir)=/usr
1617
endef
1718

1819
define $(package)_config_cmds

depends/packages/native_libmultiprocess.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package=native_libmultiprocess
2-
$(package)_version=c1b4ab4eb897d3af09bc9b3cc30e2e6fff87f3e2
2+
$(package)_version=015e95f7ebaa47619a213a19801e7fffafc56864
33
$(package)_download_path=https://github.com/chaincodelabs/libmultiprocess/archive
44
$(package)_file_name=$($(package)_version).tar.gz
5-
$(package)_sha256_hash=6edf5ad239ca9963c78f7878486fb41411efc9927c6073928a7d6edf947cac4a
5+
$(package)_sha256_hash=4b1266b121337f3f6f37e1863fba91c1a5ee9ad126bcffc6fe6b9ca47ad050a1
66
$(package)_dependencies=native_capnp
77

88
define $(package)_config_cmds

depends/toolchain.cmake.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ endif()
168168

169169
if("@multiprocess@" STREQUAL "1")
170170
set(WITH_MULTIPROCESS ON CACHE BOOL "")
171-
set(LibmultiprocessNative_DIR "${CMAKE_FIND_ROOT_PATH}/native/lib/cmake/Libmultiprocess" CACHE PATH "")
171+
set(Libmultiprocess_ROOT "${CMAKE_CURRENT_LIST_DIR}" CACHE PATH "")
172+
set(LibmultiprocessNative_ROOT "${CMAKE_CURRENT_LIST_DIR}/native" CACHE PATH "")
172173
else()
173174
set(WITH_MULTIPROCESS OFF CACHE BOOL "")
174175
endif()

doc/design/multiprocess.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ This section describes the major components of the Inter-Process Communication (
8181
- In the generated code, we have C++ client subclasses that inherit from the abstract classes in [`src/interfaces/`](../../src/interfaces/). These subclasses are the workhorses of the IPC mechanism.
8282
- They implement all the methods of the interface, marshalling arguments into a structured format, sending them as requests to the IPC server via a UNIX socket, and handling the responses.
8383
- These subclasses effectively mask the complexity of IPC, presenting a familiar C++ interface to developers.
84-
- Internally, the client subclasses generated by the `mpgen` tool wrap [client classes generated by Cap'n Proto](https://capnproto.org/cxxrpc.html#clients), and use them to send IPC requests.
84+
- Internally, the client subclasses generated by the `mpgen` tool wrap [client classes generated by Cap'n Proto](https://capnproto.org/cxxrpc.html#clients), and use them to send IPC requests. The Cap'n Proto client classes are low-level, with non-blocking methods that use asynchronous I/O and pass request and response objects, while mpgen client subclasses provide normal C++ methods that block while executing and convert between request/response objects and arguments/return values.
8585

8686
### C++ Server Classes in Generated Code
8787
- On the server side, corresponding generated C++ classes receive IPC requests. These server classes are responsible for unmarshalling method arguments, invoking the corresponding methods in the local [`src/interfaces/`](../../src/interfaces/) objects, and creating the IPC response.
@@ -94,7 +94,7 @@ This section describes the major components of the Inter-Process Communication (
9494
- **Asynchronous I/O and Thread Management**: The library is also responsible for managing I/O and threading. Particularly, it ensures that IPC requests never block each other and that new threads on either side of a connection can always make client calls. It also manages worker threads on the server side of calls, ensuring that calls from the same client thread always execute on the same server thread (to avoid locking issues and support nested callbacks).
9595

9696
### Type Hooks in [`src/ipc/capnp/*-types.h`](../../src/ipc/capnp/)
97-
- **Custom Type Conversions**: In [`src/ipc/capnp/*-types.h`](../../src/ipc/capnp/), function overloads of two `libmultiprocess` C++ functions, `mp::CustomReadField` and `mp::CustomBuildFields`, are defined. These overloads are used for customizing the conversion of specific C++ types to and from Cap’n Proto types.
97+
- **Custom Type Conversions**: In [`src/ipc/capnp/*-types.h`](../../src/ipc/capnp/), function overloads of `libmultiprocess` C++ functions, `mp::CustomReadField`, `mp::CustomBuildField`, `mp::CustomReadMessage` and `mp::CustomBuildMessage`, are defined. These overloads are used for customizing the conversion of specific C++ types to and from Cap’n Proto types.
9898
- **Handling Special Cases**: The `mpgen` tool and `libmultiprocess` library can convert most C++ types to and from Cap’n Proto types automatically, including interface types, primitive C++ types, standard C++ types like `std::vector`, `std::set`, `std::map`, `std::tuple`, and `std::function`, as well as simple C++ structs that consist of aforementioned types and whose fields correspond 1:1 with Cap’n Proto struct fields. For other types, `*-types.h` files provide custom code to convert between C++ and Cap’n Proto data representations.
9999

100100
### Protocol-Agnostic IPC Code in [`src/ipc/`](../../src/ipc/)
@@ -197,7 +197,7 @@ sequenceDiagram
197197
- Upon receiving the request, the Cap'n Proto dispatching code in the `bitcoin-node` process calls the `getBlockHash` method of the `Chain` [server class](#c-server-classes-in-generated-code).
198198
- The server class is automatically generated by the `mpgen` tool from the [`chain.capnp`](https://github.com/ryanofsky/bitcoin/blob/pr/ipc/src/ipc/capnp/chain.capnp) file in [`src/ipc/capnp/`](../../src/ipc/capnp/).
199199
- The `getBlockHash` method of the generated `Chain` server subclass in `bitcoin-wallet` receives a Cap’n Proto request object with the `height` parameter, and calls the `getBlockHash` method on its local `Chain` object with the provided `height`.
200-
- When the call returns, it encapsulates the return value in a Cap’n Proto response, which it sends back to the `bitcoin-wallet` process,
200+
- When the call returns, it encapsulates the return value in a Cap’n Proto response, which it sends back to the `bitcoin-wallet` process.
201201

202202
5. **Response and Return**
203203
- The `getBlockHash` method of the generated `Chain` client subclass in `bitcoin-wallet` which sent the request now receives the response.
@@ -232,7 +232,7 @@ This modularization represents an advancement in Bitcoin Core's architecture, of
232232

233233
- **Cap’n Proto struct**: A structured data format used in Cap’n Proto, similar to structs in C++, for organizing and transporting data across different processes.
234234

235-
- **client class (in generated code)**: A C++ class generated from a Cap’n Proto interface which inherits from a Bitcoin core abstract class, and implements each virtual method to send IPC requests to another process. (see also [components section](#c-client-subclasses-in-generated-code))
235+
- **client class (in generated code)**: A C++ class generated from a Cap’n Proto interface which inherits from a Bitcoin Core abstract class, and implements each virtual method to send IPC requests to another process. (see also [components section](#c-client-subclasses-in-generated-code))
236236

237237
- **IPC (inter-process communication)**: Mechanisms that enable processes to exchange requests and data.
238238

doc/fuzzing.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,11 @@ $ ./honggfuzz/honggfuzz --exit_upon_crash --quiet --timeout 4 -n 1 -Q \
285285
# OSS-Fuzz
286286
287287
Bitcoin Core participates in Google's [OSS-Fuzz](https://github.com/google/oss-fuzz/tree/master/projects/bitcoin-core)
288-
program, which includes a dashboard of [publicly disclosed vulnerabilities](https://bugs.chromium.org/p/oss-fuzz/issues/list?q=bitcoin-core).
289-
Generally, we try to disclose vulnerabilities as soon as possible after they
290-
are fixed to give users the knowledge they need to be protected. However,
291-
because Bitcoin is a live P2P network, and not just standalone local software,
292-
we might not fully disclose every issue within Google's standard
288+
program, which includes a dashboard of [publicly disclosed vulnerabilities](https://issues.oss-fuzz.com/issues?q=bitcoin-core%20status:open).
289+
290+
Bitcoin Core follows its [security disclosure policy](https://bitcoincore.org/en/security-advisories/),
291+
which may differ from Google's standard
293292
[90-day disclosure window](https://google.github.io/oss-fuzz/getting-started/bug-disclosure-guidelines/)
294-
if a partial or delayed disclosure is important to protect users or the
295-
function of the network.
293+
.
296294
297295
OSS-Fuzz also produces [a fuzzing coverage report](https://oss-fuzz.com/coverage-report/job/libfuzzer_asan_bitcoin-core/latest).

doc/multiprocess.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ The multiprocess feature requires [Cap'n Proto](https://capnproto.org/) and [lib
1717
```
1818
cd <BITCOIN_SOURCE_DIRECTORY>
1919
make -C depends NO_QT=1 MULTIPROCESS=1
20-
cmake -B build --toolchain=depends/x86_64-pc-linux-gnu/toolchain.cmake
20+
# Set host platform to output of gcc -dumpmachine or clang -dumpmachine or check the depends/ directory for the generated subdirectory name
21+
HOST_PLATFORM="x86_64-pc-linux-gnu"
22+
cmake -B build --toolchain=depends/$HOST_PLATFORM/toolchain.cmake
2123
cmake --build build
2224
build/src/bitcoin-node -regtest -printtoconsole -debug=ipc
2325
BITCOIND=$(pwd)/build/src/bitcoin-node build/test/functional/test_runner.py

0 commit comments

Comments
 (0)