Compare commits

..

99 Commits

Author SHA1 Message Date
SChernykh 60285a21dd p2pool v4.8 2025-06-15 09:57:28 +02:00
SChernykh 8f716bd1f1 Merge pull request #363 from Low-power/last-pool-share-found-time-in-local-stratum-api
API: add `last_share_found_time` in `local/stratum`
2025-06-14 12:52:07 +02:00
WHR 009fa0f474 API: add 'last_share_found_time' in local/stratum 2025-06-14 10:26:07 +08:00
SChernykh cea19f1c0d Log: reopen it in the worker thread only
Moved it to the worker thread to contain  it - there is no need to have outside access to its data.
2025-06-12 11:48:55 +02:00
SChernykh 0d0bf9cdee Merge pull request #362 from Low-power/reopen-log-file
Reopening of the log file on SIGUSR1 didn't work as expected
2025-06-11 23:11:32 +02:00
SChernykh c353daeb85 TCPServer: fixed SOCKS5 error checking logic 2025-06-11 20:14:35 +02:00
WHR 865bce5774 Always reopen the log file on SIGUSR1 2025-06-12 00:53:44 +08:00
SChernykh 853b942af7 Console: fixed command length calculation 2025-06-11 16:48:48 +02:00
SChernykh a9d9e1b48a Merge pull request #361 from Low-power/docs-bsd-rc-script
Create document for running P2Pool as a service on FreeBSD
2025-06-11 13:33:23 +02:00
SChernykh 2f06a8b9b8 Fixed build 2025-06-11 12:45:35 +02:00
WHR 197b260d88 Create document for running P2Pool as a service on FreeBSD 2025-06-11 18:38:47 +08:00
SChernykh 26bf2f07a0 Console: don't let random unformatted data end up in the log 2025-06-11 11:49:38 +02:00
SChernykh 09532c901a CMake: removed unused dependencies 2025-06-11 10:22:07 +02:00
SChernykh ab89a3c792 Fixed GCC-8 builds 2025-06-10 22:20:55 +02:00
SChernykh 2fe5dd8a36 Console: don't listen on a TCP port when local API is not enabled 2025-06-10 22:11:26 +02:00
SChernykh 17279708e5 Console: limit access via TCP 2025-06-10 21:51:05 +02:00
SChernykh e577b298b6 CI: fixed MSVC paths 2025-06-10 20:57:01 +02:00
SChernykh d66a2603e3 Merge pull request #360 from Low-power/mebibyte-unit
Correct unit prefix symbol for unit `mebibyte`
2025-06-10 19:30:08 +02:00
SChernykh 8bb317c4b7 CI: added Ubuntu RISC-V build, fixed Windows builds 2025-06-10 19:13:14 +02:00
SChernykh 9ce118ed82 Merge pull request #358 from Low-power/configurable-stratum-ban-time
Make ban time of stratum clients configurable
2025-06-10 18:34:16 +02:00
WHR aa303a96d1 Correct unit prefix symbol for unit 'mebibyte' 2025-06-10 21:16:21 +08:00
WHR 6c4520481b Make ban time of stratum clients configurable via '--stratum-ban-time' option 2025-06-10 20:08:09 +08:00
SChernykh 62707656eb Merge pull request #357 from Low-power/kilohash-per-second-unit
Correct unit prefix symbol for unit `kilohash per second`
2025-06-10 14:06:00 +02:00
WHR 20caceee5d Correct unit prefix symbol for unit 'kilohash per second' 2025-06-10 11:38:25 +08:00
SChernykh 3ac7c0c243 CI: use latest-stable Alpine branch for the RISC-V build 2025-06-09 15:38:37 +02:00
SChernykh ae6a08ee25 Self-test: added more output 2025-06-09 08:35:39 +02:00
SChernykh afa82f4b48 Fixed build 2025-06-08 23:46:10 +02:00
SChernykh e7f87085fb Fixed host ping time calculation when using SOCKS5 proxy 2025-06-08 20:37:55 +02:00
SChernykh 3147a2e968 Fixed build errors 2025-06-06 20:21:47 +02:00
SChernykh 435e6c7599 Tari: added block push via gRPC API 2025-06-06 19:02:08 +02:00
SChernykh ce840733f1 Merge mining: get a new block template immediately after submitting a block. 2025-06-06 12:36:17 +02:00
SChernykh 54d278643d CI: sync test - added merge mining 2025-06-05 23:22:11 +02:00
SChernykh 8d639bfcf2 API: added chain ID to the merge mining data 2025-06-05 11:31:06 +02:00
SChernykh d3026a97b7 API: added merge mining data 2025-06-04 11:46:10 +02:00
SChernykh 77c28df3f0 Updated curl to 8.14.1 2025-06-04 10:09:41 +02:00
SChernykh b06fcc7516 Fix: don't use outdated merge mining data
And warn the user in the log
2025-06-02 14:09:28 +02:00
SChernykh a01ea2d9d8 Updated Monero/P2Pool hardfork info 2025-05-30 14:19:52 +02:00
SChernykh 0d7b110f15 Fix: more robust startup sequence 2025-05-29 17:44:08 +02:00
SChernykh 7cd21f5d0e p2pool v4.7 2025-05-29 13:43:07 +02:00
SChernykh 886da5a73e CI: fixed msys2 clang build 2025-05-29 09:16:03 +02:00
SChernykh bfa30254df Fixed build errors 2025-05-28 20:10:52 +02:00
SChernykh b589d373ea P2Pool-nano: display correct parameters at start-up 2025-05-28 17:47:18 +02:00
SChernykh 8333f7800f P2Pool-nano: fixed sync when using restricted RPC nodes 2025-05-28 17:13:16 +02:00
SChernykh 91fb15e967 Updated curl to 8.14.0 2025-05-28 16:16:12 +02:00
SChernykh e0c1d9377c P2Pool-nano support 2025-05-28 15:04:11 +02:00
SChernykh 3f80244d84 Updated miniupnp 2025-05-27 15:10:51 +02:00
SChernykh 433a1991bc Updated cppzmq 2025-05-27 15:07:40 +02:00
SChernykh 915be9e39f Tari: fixed max gRPC message size 2025-05-27 12:58:54 +02:00
SChernykh b9e415c659 Updated Tari gRPC proto files 2025-05-25 10:07:28 +02:00
SChernykh 1e2e5b85aa CI: don't build extra binaries when building tests 2025-05-23 10:45:40 +02:00
SChernykh 40999f0056 Fix: failure to connect to a node if its domain resolves to an IPv6 address 2025-05-21 10:34:22 +02:00
SChernykh cf51fe5273 p2pool v4.6 2025-05-17 09:05:09 +02:00
SChernykh 3154b61fc6 P2PServer: show protocol version in peer list 2025-05-16 09:40:14 +02:00
SChernykh f9831500e4 Fixed build 2025-05-16 08:11:22 +02:00
SChernykh e9d49b2a1d Added missing #ifdef 2025-05-15 23:21:47 +02:00
SChernykh 5eabfb0a1a Fixed Coverity errors 2025-05-15 22:38:54 +02:00
SChernykh 3fc68e680a Tweaked log messages 2025-05-15 18:43:22 +02:00
SChernykh 1bd9ff1379 Stratum local API: added wallet address 2025-05-15 16:32:44 +02:00
SChernykh 9a0a96f990 Merge pull request #349 from SChernykh/mm_donate
Merge mining donation support
2025-05-15 16:15:06 +02:00
SChernykh 604ef13aa6 Tari merge mining: added more checks 2025-05-15 12:28:07 +02:00
SChernykh 293c6f3930 Updated merge mining docs 2025-05-15 08:27:58 +02:00
SChernykh 1f3872254d Tari: more efficient polling
Use `GetTipInfo` gRPC call to quickly check for changes
2025-05-14 12:47:31 +02:00
SChernykh 27a2461d1d Tari: don't update the aux data too often if only fees change 2025-05-14 09:41:24 +02:00
SChernykh 70298cd065 Merge mining donation support 2025-05-13 17:18:29 +02:00
SChernykh f655fd1e30 Tari: smaller reconnect timeouts 2025-05-11 21:17:29 +02:00
SChernykh 9abe993bb0 Moved GCC 15 fix to flags.cmake 2025-05-07 18:33:30 +02:00
SChernykh 2a30901ba5 Added comments to PoolBlock::get_pow_hash
To explain what looks like a random magic code there
2025-05-07 16:21:27 +02:00
SChernykh 2c29092b7a Updated Tari merge mining docs 2025-05-06 20:02:39 +02:00
SChernykh 7d610f61d5 Sync test: updated Monero nodes 2025-05-04 10:39:48 +02:00
SChernykh 7d632fdc85 More informative main thread name 2025-05-03 17:53:51 +02:00
SChernykh 2416a80642 p2pool v4.5
Sync test / sync-test-ubuntu-tsan (push) Has been cancelled
Sync test / sync-test-ubuntu-msan (push) Has been cancelled
Sync test / sync-test-ubuntu-ubsan (push) Has been cancelled
Sync test / sync-test-ubuntu-asan (push) Has been cancelled
Sync test / sync-test-macos (map[flags: os:macos-13]) (push) Has been cancelled
Sync test / sync-test-macos (map[flags:-target arm64-apple-macos-11 os:macos-14]) (push) Has been cancelled
Sync test / sync-test-windows-debug-asan (push) Has been cancelled
Sync test / sync-test-windows-leaks (push) Has been cancelled
source-snapshot / source-snapshot (push) Has been cancelled
Microsoft C++ Code Analysis / Analyze (push) Has been cancelled
cppcheck / cppcheck-ubuntu (push) Has been cancelled
cppcheck / cppcheck-windows (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
clang-tidy / clang-tidy (push) Has been cancelled
C/C++ CI / build-alpine-static (map[arch:aarch64 branch:latest-stable flags:-ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419]) (push) Has been cancelled
C/C++ CI / build-alpine-static (map[arch:riscv64 branch:edge flags:-ffunction-sections]) (push) Has been cancelled
C/C++ CI / build-alpine-static (map[arch:x86_64 branch:latest-stable flags:-ffunction-sections]) (push) Has been cancelled
C/C++ CI / build-ubuntu (map[c:gcc-10 cpp:g++-10 flags: os:ubuntu-22.04]) (push) Has been cancelled
C/C++ CI / build-ubuntu (map[c:gcc-11 cpp:g++-11 flags: os:ubuntu-22.04]) (push) Has been cancelled
C/C++ CI / build-ubuntu (map[c:gcc-12 cpp:g++-12 flags: os:ubuntu-22.04]) (push) Has been cancelled
C/C++ CI / build-ubuntu (map[c:gcc-13 cpp:g++-13 flags: os:ubuntu-24.04]) (push) Has been cancelled
C/C++ CI / build-ubuntu (map[c:gcc-14 cpp:g++-14 flags: os:ubuntu-24.04]) (push) Has been cancelled
C/C++ CI / build-ubuntu (map[c:gcc-9 cpp:g++-9 flags: os:ubuntu-22.04]) (push) Has been cancelled
C/C++ CI / build-ubuntu-static-libs (map[flags:-fuse-linker-plugin -ffunction-sections]) (push) Has been cancelled
C/C++ CI / build-ubuntu-aarch64 (map[flags:-fuse-linker-plugin -ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 os:ubuntu-22.04]) (push) Has been cancelled
C/C++ CI / build-ubuntu-aarch64 (map[flags:-fuse-linker-plugin -ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 os:ubuntu-24.04]) (push) Has been cancelled
C/C++ CI / build-windows-msys2 (map[c:clang cxx:clang++ flags:-fuse-ld=lld -Wno-unused-command-line-argument -Wno-nan-infinity-disabled -Wno-error=cpp]) (push) Has been cancelled
C/C++ CI / build-windows-msys2 (map[c:gcc cxx:g++ flags:-ffunction-sections -Wno-error=maybe-uninitialized -Wno-error=attributes -Wno-error=cpp]) (push) Has been cancelled
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2019 rx:OFF tls:OFF upnp:OFF vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Has been cancelled
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2019 rx:OFF tls:ON upnp:OFF vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Has been cancelled
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2019 rx:OFF tls:ON upnp:ON vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Has been cancelled
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2019 rx:ON tls:ON upnp:ON vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Has been cancelled
C/C++ CI / build-windows-msbuild (map[grpc:ON os:2019 rx:ON tls:ON upnp:ON vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Has been cancelled
C/C++ CI / build-windows-msbuild (map[grpc:ON os:2022 rx:ON tls:ON upnp:ON vs:Visual Studio 17 2022 vspath:C:\Program Files\Microsoft Visual Studio\2022\Enterprise]) (push) Has been cancelled
C/C++ CI / build-macos (push) Has been cancelled
C/C++ CI / build-macos-aarch64 (push) Has been cancelled
C/C++ CI / build-freebsd (map[architecture:x86-64 host:ubuntu-latest name:freebsd version:13.3]) (push) Has been cancelled
C/C++ CI / build-openbsd (map[architecture:x86-64 host:ubuntu-latest name:openbsd version:7.4]) (push) Has been cancelled
2025-05-03 11:06:46 +02:00
SChernykh 779f72a71e Sync test: updated Monero nodes 2025-05-02 07:58:44 +02:00
SChernykh 6483c32c8d Fixed GCC 15 compilation 2025-05-01 17:28:11 +02:00
SChernykh 3f9c622b88 Updated googletest to v1.17.0 2025-05-01 10:09:48 +02:00
SChernykh 68cbf91fc7 Removed msys2 patch (not necessary now) 2025-04-29 11:42:11 +02:00
SChernykh df21dd48af Fixed std::random_device usage 2025-04-29 11:07:03 +02:00
SChernykh 9462f2a85b Updated libuv to v1.51.0 2025-04-25 20:15:59 +02:00
SChernykh 9e37216be2 CI: fixed builds 2025-04-02 11:29:37 +02:00
SChernykh 901b6cb828 Updated curl to 8.13.0 2025-04-02 09:56:45 +02:00
SChernykh 2396725eb8 CI: fixed builds again 2025-04-01 10:31:40 +02:00
SChernykh 11236f7dc8 Fixed sync test with cmake 4.0 2025-03-29 10:21:26 +01:00
SChernykh 8b4b06f1be ZMQ: fixed connect detection
It could give false negative if the connection took >= 1000 ms.
2025-03-22 21:44:07 +01:00
SChernykh 55e12a3715 Fixed unaligned memory accesses 2025-03-20 19:00:02 +01:00
SChernykh a66716c0b1 Log: fixed unsafe read 2025-03-20 11:45:47 +01:00
SChernykh abde2ef1ce CI: updated msan sync test to use clang 20 2025-03-19 16:15:45 +01:00
SChernykh f94d411f3c Updated Tari gRPC proto files 2025-03-19 13:51:53 +01:00
SChernykh 6178277745 Switch to another host during startup if the current host is unavailable 2025-03-19 11:15:41 +01:00
SChernykh a55858b44f More debug thread name fixes 2025-03-16 14:39:56 +01:00
SChernykh 2449366d87 Updated libuv 2025-03-14 10:10:29 +01:00
SChernykh d1dd95d9c9 Set thread names for better debugging 2025-03-13 11:19:58 +01:00
SChernykh 37e8cc01cf Fixed a crash in RISC-V build when huge pages are not available 2025-03-12 15:16:39 +01:00
SChernykh e182c4c992 RandomX self-test: try to allocate using large pages first 2025-03-12 12:23:48 +01:00
SChernykh 71b6b8fdef Updated jinja2 version 2025-03-08 23:21:38 +01:00
SChernykh 860bb7b067 Updated miniupnp 2025-03-05 12:50:21 +01:00
SChernykh 7361ddf24d CI: removed an incorrect parameter for Windows test builds 2025-03-04 13:43:19 +01:00
SChernykh 1a3ce762b3 Fixed slow MSAN debug build 2025-03-04 12:06:42 +01:00
SChernykh d006ac2c6e Better gcc/clang debugging flags 2025-03-04 00:41:07 +01:00
SChernykh 13bd678c03 Correct compiler flags for CMake debug configs 2025-03-02 17:11:09 +01:00
SChernykh 4aef6cf8bb CI: removed deprecated ubuntu-20.04 2025-03-01 20:14:31 +01:00
78 changed files with 6239 additions and 1060 deletions
+157 -64
View File
@@ -2,6 +2,7 @@ name: C/C++ CI
on:
push:
branches: ["master"]
paths-ignore:
- 'docker-compose/**'
- 'docs/**'
@@ -13,14 +14,14 @@ jobs:
build-alpine-static:
timeout-minutes: 240
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
strategy:
matrix:
config:
- {arch: x86_64, branch: latest-stable, flags: "-ffunction-sections"}
- {arch: aarch64, branch: latest-stable, flags: "-ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419"}
- {arch: riscv64, branch: edge, flags: "-ffunction-sections"}
- {arch: riscv64, branch: latest-stable, flags: "-ffunction-sections"}
steps:
- name: Setup Alpine Linux
@@ -43,7 +44,7 @@ jobs:
shell: alpine.sh {0}
run: |
cd external/src/curl
cmake . -DCMAKE_C_FLAGS="-Os -flto=auto ${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Os -flto=auto ${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
make -j$(nproc)
cd lib && mkdir .libs && cp libcurl.a .libs
@@ -53,7 +54,7 @@ jobs:
cd external/src/libuv
mkdir build
cd build
cmake .. -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
make -j$(nproc)
- name: Build libzmq
@@ -62,7 +63,7 @@ jobs:
cd external/src/libzmq
mkdir build
cd build
cmake .. -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5" -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
make -j$(nproc)
- name: Build p2pool
@@ -70,7 +71,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_BINARY=ON -DARCH_ID=${{ matrix.config.arch }}
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5" -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_BINARY=ON -DARCH_ID=${{ matrix.config.arch }}
make -j$(nproc) p2pool
- name: Run RandomX tests
@@ -87,8 +88,8 @@ jobs:
cd tests
mkdir build
cd build
cmake .. -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DARCH_ID=${{ matrix.config.arch }}
make -j$(nproc)
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5" -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DARCH_ID=${{ matrix.config.arch }}
make -j$(nproc) p2pool_tests
- name: Run tests
shell: alpine.sh {0}
@@ -117,16 +118,19 @@ jobs:
strategy:
matrix:
config:
- {os: ubuntu-20.04, c: gcc-8, cpp: g++-8, flags: ""}
- {os: ubuntu-20.04, c: gcc-11, cpp: g++-11, flags: ""}
- {os: ubuntu-22.04, c: gcc-9, cpp: g++-9, flags: ""}
- {os: ubuntu-22.04, c: gcc-10, cpp: g++-10, flags: ""}
- {os: ubuntu-22.04, c: gcc-11, cpp: g++-11, flags: ""}
- {os: ubuntu-22.04, c: gcc-12, cpp: g++-12, flags: ""}
- {os: ubuntu-24.04, c: gcc-13, cpp: g++-13, flags: ""}
- {os: ubuntu-24.04, c: gcc-14, cpp: g++-14, flags: ""}
steps:
- name: Install dependencies
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install -y git build-essential cmake libuv1-dev libzmq3-dev libsodium-dev libpgm-dev libnorm-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev ${{ matrix.config.c }} ${{ matrix.config.cpp }}
sudo apt install -y git build-essential cmake libuv1-dev libzmq3-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev ${{ matrix.config.c }} ${{ matrix.config.cpp }}
- name: Checkout repository
uses: actions/checkout@v4
@@ -137,7 +141,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cpp }} -DCMAKE_C_FLAGS='${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }}'
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cpp }} -DCMAKE_C_FLAGS='${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }}' -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc) p2pool
- name: Run RandomX tests
@@ -152,8 +156,8 @@ jobs:
cd tests
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cpp }} -DCMAKE_C_FLAGS='${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }}'
make -j$(nproc)
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cpp }} -DCMAKE_C_FLAGS='${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }}' -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc) p2pool_tests
- name: Run tests
run: |
@@ -193,7 +197,7 @@ jobs:
- name: Build libcurl
run: |
cd external/src/curl
cmake . -DCMAKE_C_FLAGS="-Os -flto=auto ${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Os -flto=auto ${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
make -j$(nproc)
cd lib && mkdir .libs && cp libcurl.a .libs
@@ -202,7 +206,7 @@ jobs:
cd external/src/libuv
mkdir build
cd build
cmake .. -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
make -j$(nproc)
- name: Build libzmq
@@ -210,14 +214,14 @@ jobs:
cd external/src/libzmq
mkdir build
cd build
cmake .. -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc)
- name: Build p2pool
run: |
mkdir build
cd build
cmake .. -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc) p2pool
- name: Run RandomX tests
@@ -232,8 +236,8 @@ jobs:
cd tests
mkdir build
cd build
cmake .. -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON
make -j$(nproc)
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc) p2pool_tests
- name: Run tests
run: |
@@ -255,7 +259,6 @@ jobs:
strategy:
matrix:
config:
- {os: ubuntu-20.04, flags: "-fuse-linker-plugin -ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419"}
- {os: ubuntu-22.04, flags: "-fuse-linker-plugin -ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419"}
steps:
@@ -272,7 +275,7 @@ jobs:
- name: Build libcurl
run: |
cd external/src/curl
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/aarch64_toolchain.cmake -DCMAKE_C_FLAGS="-Os -flto=auto ${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../../cmake/aarch64_toolchain.cmake -DCMAKE_C_FLAGS="-Os -flto=auto ${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
make -j$(nproc)
cd lib && mkdir .libs && cp libcurl.a .libs
@@ -281,7 +284,7 @@ jobs:
cd external/src/libuv
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../../cmake/aarch64_toolchain.cmake -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../../cmake/aarch64_toolchain.cmake -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
make -j$(nproc)
- name: Build libzmq
@@ -289,14 +292,14 @@ jobs:
cd external/src/libzmq
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../../cmake/aarch64_toolchain.cmake -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../../cmake/aarch64_toolchain.cmake -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc)
- name: Build p2pool
run: |
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/aarch64_toolchain.cmake -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DARCH_ID=aarch64
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../cmake/aarch64_toolchain.cmake -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DARCH_ID=aarch64 -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc) p2pool
- name: Run RandomX tests
@@ -311,8 +314,8 @@ jobs:
cd tests
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_STRIP=/usr/bin/aarch64-linux-gnu-strip -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DARCH_ID=aarch64
make -j$(nproc)
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_STRIP=/usr/bin/aarch64-linux-gnu-strip -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DARCH_ID=aarch64 -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc) p2pool_tests
- name: Run tests
run: |
@@ -326,6 +329,102 @@ jobs:
name: p2pool-${{ matrix.config.os }}-aarch64
path: build/p2pool
build-ubuntu-riscv64:
timeout-minutes: 60
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- {os: ubuntu-22.04, flags: "-fuse-linker-plugin -ffunction-sections"}
steps:
- name: Setup Alpine Linux
uses: jirutka/setup-alpine@v1
with:
arch: riscv64
branch: latest-stable
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y git build-essential cmake gcc-riscv64-linux-gnu g++-riscv64-linux-gnu binutils-riscv64-linux-gnu
sudo cp /usr/riscv64-linux-gnu/lib/* /home/runner/rootfs/alpine-latest-riscv64/lib
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Build libcurl
run: |
cd external/src/curl
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../../cmake/riscv64_toolchain.cmake -DCMAKE_C_FLAGS="-Os -flto=auto ${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
make -j$(nproc)
cd lib && mkdir .libs && cp libcurl.a .libs
- name: Build libuv
run: |
cd external/src/libuv
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../../cmake/riscv64_toolchain.cmake -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
make -j$(nproc)
- name: Build libzmq
run: |
cd external/src/libzmq
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../../cmake/riscv64_toolchain.cmake -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc)
- name: Build p2pool
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../cmake/riscv64_toolchain.cmake -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DARCH_ID=riscv64 -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc) p2pool
- name: Run self-test
shell: alpine.sh {0}
run: build/p2pool --test
- name: Build RandomX tests
run: |
cd build
make -j$(nproc) randomx-tests
- name: Run RandomX tests
shell: alpine.sh {0}
run: build/external/src/RandomX/randomx-tests
- name: Build tests
run: |
cd tests
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../cmake/riscv64_toolchain.cmake -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DARCH_ID=riscv64 -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc) p2pool_tests
- name: Prepare test data
run: |
cd tests/build
gunzip *.gz
- name: Run tests
shell: alpine.sh {0}
run: |
cd tests/build
./p2pool_tests
- name: Archive binary
uses: actions/upload-artifact@v4
with:
name: p2pool-${{ matrix.config.os }}-riscv64
path: build/p2pool
build-windows-msys2:
timeout-minutes: 60
@@ -353,15 +452,10 @@ jobs:
update: true
install: mingw-w64-x86_64-toolchain mingw-w64-x86_64-clang mingw-w64-x86_64-lld mingw-w64-x86_64-cmake make git
- name: Apply patch
run: |
cd /
git apply --verbose --ignore-whitespace --directory=mingw64/include/c++/`ls mingw64/include/c++`/ /d/a/p2pool/p2pool/patches/msys2/typeinfo.patch
- name: Build libcurl
run: |
cd external/src/curl
cmake . -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_C_FLAGS="-Os ${{ matrix.config.flags }}" -DCURL_TARGET_WINDOWS_VERSION=0x0600 -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
cmake . -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_C_FLAGS="-Os ${{ matrix.config.flags }}" -DCURL_TARGET_WINDOWS_VERSION=0x0600 -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
make -j$(nproc)
cd lib && mkdir .libs && cp libcurl.a .libs
@@ -370,7 +464,7 @@ jobs:
cd external/src/libuv
mkdir build
cd build
cmake .. -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_C_FLAGS='-Os ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_C_FLAGS='-Os ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
make -j$(nproc)
- name: Build libzmq
@@ -378,14 +472,14 @@ jobs:
cd external/src/libzmq
mkdir build
cd build
cmake .. -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_FLAGS='-Os ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DZMQ_HAVE_IPC=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_FLAGS='-Os ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DZMQ_HAVE_IPC=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc)
- name: Build p2pool
run: |
mkdir build
cd build
cmake .. -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_FLAGS="${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections" -DCMAKE_CXX_FLAGS="${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections" -DSTATIC_LIBS=ON -DOPENSSL_NO_ASM=ON -DWITH_LTO=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_FLAGS="${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections" -DCMAKE_CXX_FLAGS="${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections" -DSTATIC_LIBS=ON -DOPENSSL_NO_ASM=ON -DWITH_LTO=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc) p2pool
- name: Run RandomX tests
@@ -400,8 +494,8 @@ jobs:
cd tests
mkdir build
cd build
cmake .. -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_FLAGS="${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections" -DCMAKE_CXX_FLAGS="${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections" -DSTATIC_LIBS=ON -DOPENSSL_NO_ASM=ON
make -j$(nproc)
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_FLAGS="${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections" -DCMAKE_CXX_FLAGS="${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections" -DSTATIC_LIBS=ON -DOPENSSL_NO_ASM=ON
make -j$(nproc) p2pool_tests
- name: Run tests
run: |
@@ -424,11 +518,10 @@ jobs:
matrix:
config:
- {vs: Visual Studio 17 2022, os: 2022, vspath: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise", rx: "ON", upnp: "ON", grpc: "ON", tls: "ON"}
- {vs: Visual Studio 16 2019, os: 2019, vspath: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", rx: "ON", upnp: "ON", grpc: "ON", tls: "ON"}
- {vs: Visual Studio 16 2019, os: 2019, vspath: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", rx: "ON", upnp: "ON", grpc: "OFF", tls: "ON"}
- {vs: Visual Studio 16 2019, os: 2019, vspath: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", rx: "OFF", upnp: "ON", grpc: "OFF", tls: "ON"}
- {vs: Visual Studio 16 2019, os: 2019, vspath: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", rx: "OFF", upnp: "OFF", grpc: "OFF", tls: "ON"}
- {vs: Visual Studio 16 2019, os: 2019, vspath: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", rx: "OFF", upnp: "OFF", grpc: "OFF", tls: "OFF"}
- {vs: Visual Studio 17 2022, os: 2022, vspath: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise", rx: "ON", upnp: "ON", grpc: "OFF", tls: "ON"}
- {vs: Visual Studio 17 2022, os: 2022, vspath: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise", rx: "OFF", upnp: "ON", grpc: "OFF", tls: "ON"}
- {vs: Visual Studio 17 2022, os: 2022, vspath: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise", rx: "OFF", upnp: "OFF", grpc: "OFF", tls: "ON"}
- {vs: Visual Studio 17 2022, os: 2022, vspath: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise", rx: "OFF", upnp: "OFF", grpc: "OFF", tls: "OFF"}
steps:
- name: Checkout repository
@@ -447,7 +540,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -G "${{ matrix.config.vs }}" -DCMAKE_SYSTEM_VERSION="10.0" -DWITH_RANDOMX=${{ matrix.config.rx }} -DWITH_UPNP=${{ matrix.config.upnp }} -DWITH_GRPC=${{ matrix.config.grpc }} -DWITH_TLS=${{ matrix.config.tls }}
cmake .. -G "${{ matrix.config.vs }}" -DCMAKE_SYSTEM_VERSION="10.0" -DWITH_RANDOMX=${{ matrix.config.rx }} -DWITH_UPNP=${{ matrix.config.upnp }} -DWITH_GRPC=${{ matrix.config.grpc }} -DWITH_TLS=${{ matrix.config.tls }} -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
& "${{ matrix.config.vspath }}\\MSBuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=Release p2pool.vcxproj
- name: Check Windows 7 compatibility
@@ -471,7 +564,7 @@ jobs:
cd tests
mkdir build
cd build
cmake .. -G "${{ matrix.config.vs }}" -DCMAKE_SYSTEM_VERSION="10.0" -DDEV_WITH_ASAN=ON
cmake .. -G "${{ matrix.config.vs }}" -DCMAKE_SYSTEM_VERSION="10.0" -DDEV_WITH_ASAN=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
& "${{ matrix.config.vspath }}\\MSBuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=Debug p2pool_tests.vcxproj
- name: Run tests
@@ -502,7 +595,7 @@ jobs:
- name: Build libcurl
run: |
cd external/src/curl
cmake . -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-Os -flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-Os -flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
make -j4
cd lib && mkdir .libs && cp libcurl.a .libs
@@ -511,7 +604,7 @@ jobs:
cd external/src/libuv
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-Os -flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-Os -flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
make -j4
- name: Build libzmq
@@ -519,14 +612,14 @@ jobs:
cd external/src/libzmq
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@15)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-Os -flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_CXX_FLAGS='-Os -flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@15)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-Os -flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_CXX_FLAGS='-Os -flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
make -j4
- name: Build p2pool
run: |
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@15)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_CXX_FLAGS='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_ASM_FLAGS='-target x86_64-apple-macos10.13' -DSTATIC_LIBS=ON
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@15)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_CXX_FLAGS='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_ASM_FLAGS='-target x86_64-apple-macos10.13' -DSTATIC_LIBS=ON
make -j4 p2pool
- name: Run RandomX tests
@@ -541,8 +634,8 @@ jobs:
cd tests
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@15)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_CXX_FLAGS='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_ASM_FLAGS='-target x86_64-apple-macos10.13' -DSTATIC_LIBS=ON
make -j4
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@15)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_CXX_FLAGS='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_ASM_FLAGS='-target x86_64-apple-macos10.13' -DSTATIC_LIBS=ON
make -j4 p2pool_tests
- name: Run tests
run: |
@@ -570,7 +663,7 @@ jobs:
- name: Build libcurl
run: |
cd external/src/curl
cmake . -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-Os -target arm64-apple-macos-11" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-Os -target arm64-apple-macos-11" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
make -j3
cd lib && mkdir .libs && cp libcurl.a .libs
@@ -579,7 +672,7 @@ jobs:
cd external/src/libuv
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-Os -target arm64-apple-macos-11' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-Os -target arm64-apple-macos-11' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
make -j3
- name: Build libzmq
@@ -587,14 +680,14 @@ jobs:
cd external/src/libzmq
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@15)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-Os -target arm64-apple-macos-11' -DCMAKE_CXX_FLAGS='-Os -target arm64-apple-macos-11' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@15)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-Os -target arm64-apple-macos-11' -DCMAKE_CXX_FLAGS='-Os -target arm64-apple-macos-11' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
make -j3
- name: Build p2pool
run: |
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@15)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-target arm64-apple-macos-11" -DCMAKE_CXX_FLAGS="-target arm64-apple-macos-11" -DSTATIC_LIBS=ON -DWITH_LTO=OFF -DARCH_ID=aarch64
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@15)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-target arm64-apple-macos-11" -DCMAKE_CXX_FLAGS="-target arm64-apple-macos-11" -DSTATIC_LIBS=ON -DWITH_LTO=OFF -DARCH_ID=aarch64
make -j3 p2pool
- name: Run RandomX tests
@@ -609,8 +702,8 @@ jobs:
cd tests
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@15)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-target arm64-apple-macos-11" -DCMAKE_CXX_FLAGS="-target arm64-apple-macos-11" -DSTATIC_LIBS=ON -DWITH_LTO=OFF -DARCH_ID=aarch64
make -j3
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@15)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-target arm64-apple-macos-11" -DCMAKE_CXX_FLAGS="-target arm64-apple-macos-11" -DSTATIC_LIBS=ON -DWITH_LTO=OFF -DARCH_ID=aarch64
make -j3 p2pool_tests
- name: Run tests
run: |
@@ -660,23 +753,23 @@ jobs:
run: |
sudo pkg install -y cmake
cd external/src/curl
cmake . -DCMAKE_C_FLAGS="-Os -flto" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Os -flto" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
make -j4
cd lib && mkdir .libs && cp libcurl.a .libs
cd ../../libuv
mkdir build
cd build
cmake .. -DCMAKE_C_FLAGS='-Os -flto' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
make -j4
cd ../../libzmq
mkdir build
cd build
cmake .. -DCMAKE_C_FLAGS='-Os -flto' -DCMAKE_CXX_FLAGS='-Os -flto' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto' -DCMAKE_CXX_FLAGS='-Os -flto' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
make -j4
cd ../../../..
mkdir build
cd build
cmake .. -DSTATIC_LIBS=ON
cmake .. -DCMAKE_BUILD_TYPE=Release -DSTATIC_LIBS=ON
make -j4 p2pool
./p2pool --test
make -j4 randomx-tests
@@ -684,7 +777,7 @@ jobs:
cd ../tests
mkdir build
cd build
cmake .. -DSTATIC_LIBS=ON
cmake .. -DCMAKE_BUILD_TYPE=Release -DSTATIC_LIBS=ON
make -j4 p2pool_tests
gunzip *.gz
./p2pool_tests
@@ -731,11 +824,11 @@ jobs:
run: |
sudo pkg_add -I cmake libuv zeromq curl
mkdir build && cd build
cmake ..
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j4 p2pool
cd ../tests
mkdir build && cd build
cmake ..
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j4 p2pool_tests
gunzip *.gz
./p2pool_tests
+2 -1
View File
@@ -2,6 +2,7 @@ name: clang-tidy
on:
push:
branches: ["master"]
paths-ignore:
- 'docker-compose/**'
- 'docs/**'
@@ -31,7 +32,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang-20 -DCMAKE_CXX_COMPILER=clang++-20 -DDEV_CLANG_TIDY=ON -DSTATIC_LIBS=ON
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang-20 -DCMAKE_CXX_COMPILER=clang++-20 -DDEV_CLANG_TIDY=ON -DSTATIC_LIBS=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
- name: Run clang-tidy
run: |
+5 -12
View File
@@ -13,6 +13,7 @@ name: "CodeQL"
on:
push:
branches: ["master"]
paths-ignore:
- 'docker-compose/**'
- 'docs/**'
@@ -44,7 +45,7 @@ jobs:
steps:
- name: Install dependencies
run: |
sudo apt update && sudo apt install git build-essential cmake libuv1-dev libzmq3-dev libsodium-dev libpgm-dev libnorm-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev
sudo apt update && sudo apt install git build-essential cmake libuv1-dev libzmq3-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev
- name: Checkout repository
uses: actions/checkout@v4
@@ -61,21 +62,13 @@ jobs:
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3
# ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- run: |
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc) p2pool
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
+11 -10
View File
@@ -2,6 +2,7 @@ name: cppcheck
on:
push:
branches: ["master"]
paths-ignore:
- 'docker-compose/**'
- 'docs/**'
@@ -25,10 +26,10 @@ jobs:
submodules: recursive
- name: Checkout cppcheck
uses: actions/checkout@v4
with:
repository: danmar/cppcheck
path: cppcheck-main
run: |
git clone https://github.com/danmar/cppcheck cppcheck-main
cd cppcheck-main
git checkout 6d7dc76052ad36128fae93f994d6a2bf57e93103
- name: Build cppcheck
run: |
@@ -39,7 +40,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DSTATIC_LIBS=ON -DWITH_GRPC=OFF
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DSTATIC_LIBS=ON -DWITH_GRPC=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
python ../cppcheck/remove_external.py compile_commands.json
- name: Run cppcheck
@@ -73,10 +74,10 @@ jobs:
submodules: recursive
- name: Checkout cppcheck
uses: actions/checkout@v4
with:
repository: danmar/cppcheck
path: cppcheck-main
run: |
git clone https://github.com/danmar/cppcheck cppcheck-main
cd cppcheck-main
git checkout 6d7dc76052ad36128fae93f994d6a2bf57e93103
- name: Build cppcheck
run: |
@@ -90,7 +91,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -G "Visual Studio 17 2022" -DSTATIC_LIBS=ON
cmake .. -G "Visual Studio 17 2022" -DSTATIC_LIBS=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
- name: Run cppcheck
run: |
+2 -1
View File
@@ -10,6 +10,7 @@ name: Microsoft C++ Code Analysis
on:
push:
branches: ["master"]
paths-ignore:
- 'docker-compose/**'
- 'docs/**'
@@ -38,7 +39,7 @@ jobs:
submodules: recursive
- name: Configure CMake
run: cmake -B ${{ env.build }} -DCMAKE_BUILD_TYPE=${{ env.config }}
run: cmake -B ${{ env.build }} -DCMAKE_BUILD_TYPE=${{ env.config }} -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
# Build is not required unless generated source files are used
# - name: Build CMake
+5 -1
View File
@@ -1,6 +1,10 @@
name: source-snapshot
on: [push, pull_request]
on:
push:
branches: ["master"]
pull_request:
jobs:
source-snapshot:
+23 -22
View File
@@ -2,6 +2,7 @@ name: Sync test
on:
push:
branches: ["master"]
paths-ignore:
- 'docker-compose/**'
- 'docs/**'
@@ -50,14 +51,14 @@ jobs:
cd external/src/libzmq
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DCMAKE_C_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
cmake .. -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DCMAKE_C_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc)
- name: Build p2pool
run: |
mkdir build
cd build
cmake .. -DDEV_TEST_SYNC=ON -DDEV_WITH_TSAN=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DCMAKE_C_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DWITH_LTO=OFF -DSTATIC_LIBS=ON
cmake .. -DDEV_TEST_SYNC=ON -DDEV_WITH_TSAN=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DCMAKE_C_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DWITH_LTO=OFF -DSTATIC_LIBS=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc) p2pool
- name: Run p2pool
@@ -68,7 +69,7 @@ jobs:
python ../tests/src/stratum_dummy.py 2 &
python ../tests/src/stratum_dummy.py 3 &
sudo sysctl vm.mmap_rnd_bits=28
TSAN_OPTIONS="suppressions=../tests/src/tsan_sup.txt halt_on_error=1 history_size=4" ./p2pool --host xmr.support --rpc-port 18081 --zmq-port 18083 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
TSAN_OPTIONS="suppressions=../tests/src/tsan_sup.txt halt_on_error=1 history_size=4" ./p2pool --host node.monerodevs.org --rpc-port 18089 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg ${{ secrets.MM_PARAMS }} --mini --out-peers 200 --data-api data --local-api --loglevel 6
- name: Check p2pool.log
run: |
@@ -97,14 +98,14 @@ jobs:
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 19
sudo ./llvm.sh 20 all
- name: Build libcxx_msan
run: |
git clone --depth=1 https://github.com/llvm/llvm-project -b release/19.x
git clone --depth=1 https://github.com/llvm/llvm-project -b release/20.x
cd llvm-project
mkdir build
cmake -G Ninja -S runtimes -B build -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" -DCMAKE_C_COMPILER=clang-19 -DCMAKE_CXX_COMPILER=clang++-19 -DLLVM_USE_SANITIZER=MemoryWithOrigins -DLIBCXXABI_USE_LLVM_UNWINDER=OFF
cmake -G Ninja -S runtimes -B build -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" -DCMAKE_C_COMPILER=clang-20 -DCMAKE_CXX_COMPILER=clang++-20 -DLLVM_USE_SANITIZER=MemoryWithOrigins -DLIBCXXABI_USE_LLVM_UNWINDER=OFF
ninja -C build cxx cxxabi
cd build
mkdir /tmp/libcxx_msan
@@ -119,7 +120,7 @@ jobs:
- name: Build libcurl
run: |
cd external/src/curl
cmake . -DCMAKE_C_COMPILER=clang-19 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Og -fno-omit-frame-pointer -g' -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
cmake . -DCMAKE_C_COMPILER=clang-20 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Og -fno-omit-frame-pointer -g' -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
make -j$(nproc)
cd lib && mkdir .libs && cp libcurl.a .libs
@@ -128,7 +129,7 @@ jobs:
cd external/src/libuv
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=clang-19 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Og -fno-omit-frame-pointer -g' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
cmake .. -DCMAKE_C_COMPILER=clang-20 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Og -fno-omit-frame-pointer -g' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
make -j$(nproc)
- name: Build libzmq
@@ -136,14 +137,14 @@ jobs:
cd external/src/libzmq
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=clang-19 -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Og -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-nostdinc++ -nostdlib++ -fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Og -fno-omit-frame-pointer -g -isystem /tmp/libcxx_msan/include/c++/v1 -L/tmp/libcxx_msan/lib -lc++ -lc++abi -Wno-unused-command-line-argument' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
cmake .. -DCMAKE_C_COMPILER=clang-20 -DCMAKE_CXX_COMPILER=clang++-20 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Og -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-nostdinc++ -nostdlib++ -fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Og -fno-omit-frame-pointer -g -isystem /tmp/libcxx_msan/include/c++/v1 -L/tmp/libcxx_msan/lib -lc++ -lc++abi -Wno-unused-command-line-argument' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc)
- name: Build p2pool
run: |
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=clang-19 -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-nostdinc++ -nostdlib++ -fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -isystem /tmp/libcxx_msan/include/c++/v1 -L/tmp/libcxx_msan/lib -Wl,-rpath /tmp/libcxx_msan/lib -lc++ -lc++abi -Wno-unused-command-line-argument -fuse-ld=lld-19 -fno-omit-frame-pointer -g' -DDEV_TEST_SYNC=ON -DDEV_WITH_MSAN=ON -DWITH_LTO=OFF -DSTATIC_LIBS=ON
cmake .. -DCMAKE_C_COMPILER=clang-20 -DCMAKE_CXX_COMPILER=clang++-20 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-nostdinc++ -nostdlib++ -fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -isystem /tmp/libcxx_msan/include/c++/v1 -L/tmp/libcxx_msan/lib -Wl,-rpath /tmp/libcxx_msan/lib -lc++ -lc++abi -Wno-unused-command-line-argument -fuse-ld=lld-20 -fno-omit-frame-pointer -g' -DDEV_TEST_SYNC=ON -DDEV_WITH_MSAN=ON -DWITH_LTO=OFF -DSTATIC_LIBS=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc) p2pool
- name: Run p2pool
@@ -154,7 +155,7 @@ jobs:
python ../tests/src/stratum_dummy.py 2 &
python ../tests/src/stratum_dummy.py 3 &
sudo sysctl vm.mmap_rnd_bits=28
MSAN_OPTIONS="halt_on_error=1" ./p2pool --host xmr.support --rpc-port 18081 --zmq-port 18083 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
MSAN_OPTIONS="halt_on_error=1" ./p2pool --host node.monerodevs.org --rpc-port 18089 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg ${{ secrets.MM_PARAMS }} --mini --out-peers 200 --data-api data --local-api --loglevel 6
- name: Check p2pool.log
run: |
@@ -179,7 +180,7 @@ jobs:
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install -y git build-essential cmake libuv1-dev libzmq3-dev libsodium-dev libpgm-dev libnorm-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev gcc-12 g++-12
sudo apt install -y git build-essential cmake libuv1-dev libzmq3-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev gcc-12 g++-12
- name: Checkout repository
uses: actions/checkout@v4
@@ -190,7 +191,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DDEV_TEST_SYNC=ON -DDEV_WITH_UBSAN=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DWITH_LTO=OFF
cmake .. -DDEV_TEST_SYNC=ON -DDEV_WITH_UBSAN=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DWITH_LTO=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc) p2pool
- name: Run p2pool
@@ -201,7 +202,7 @@ jobs:
python ../tests/src/stratum_dummy.py 2 &
python ../tests/src/stratum_dummy.py 3 &
sudo sysctl vm.mmap_rnd_bits=28
UBSAN_OPTIONS="suppressions=../tests/src/ubsan_sup.txt halt_on_error=1" ./p2pool --host xmr.support --rpc-port 18081 --zmq-port 18083 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
UBSAN_OPTIONS="suppressions=../tests/src/ubsan_sup.txt halt_on_error=1" ./p2pool --host node.monerodevs.org --rpc-port 18089 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg ${{ secrets.MM_PARAMS }} --mini --out-peers 200 --data-api data --local-api --loglevel 6
- name: Check p2pool.log
run: |
@@ -226,7 +227,7 @@ jobs:
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install -y git build-essential cmake libuv1-dev libzmq3-dev libsodium-dev libpgm-dev libnorm-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev gcc-12 g++-12
sudo apt install -y git build-essential cmake libuv1-dev libzmq3-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev gcc-12 g++-12
- name: Checkout repository
uses: actions/checkout@v4
@@ -237,7 +238,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DDEV_TEST_SYNC=ON -DDEV_WITH_ASAN=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DCMAKE_C_FLAGS="-fno-omit-frame-pointer -fsanitize=address -Og -g" -DCMAKE_CXX_FLAGS="-fno-omit-frame-pointer -fsanitize=address -Og -g" -DWITH_LTO=OFF
cmake .. -DDEV_TEST_SYNC=ON -DDEV_WITH_ASAN=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DCMAKE_C_FLAGS="-fno-omit-frame-pointer -fsanitize=address -Og -g" -DCMAKE_CXX_FLAGS="-fno-omit-frame-pointer -fsanitize=address -Og -g" -DWITH_LTO=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc) p2pool
- name: Run p2pool
@@ -248,7 +249,7 @@ jobs:
python ../tests/src/stratum_dummy.py 2 &
python ../tests/src/stratum_dummy.py 3 &
sudo sysctl vm.mmap_rnd_bits=28
ASAN_OPTIONS="detect_stack_use_after_return=1 atexit=1" ./p2pool --host xmr.support --rpc-port 18081 --zmq-port 18083 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
ASAN_OPTIONS="detect_stack_use_after_return=1 atexit=1" ./p2pool --host node.monerodevs.org --rpc-port 18089 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg ${{ secrets.MM_PARAMS }} --mini --out-peers 200 --data-api data --local-api --loglevel 6
- name: Check p2pool.log
run: |
@@ -317,7 +318,7 @@ jobs:
python3 ../tests/src/stratum_dummy.py 1 &
python3 ../tests/src/stratum_dummy.py 2 &
python3 ../tests/src/stratum_dummy.py 3 &
./p2pool --host xmr.support --rpc-port 18081 --zmq-port 18083 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
./p2pool --host node.monerodevs.org --rpc-port 18089 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg ${{ secrets.MM_PARAMS }} --mini --out-peers 200 --data-api data --local-api --loglevel 6
- name: Check p2pool.log
run: |
@@ -350,7 +351,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -G "Visual Studio 17 2022" -DCMAKE_SYSTEM_VERSION="10.0" -DDEV_TEST_SYNC=ON -DDEV_WITH_ASAN=ON
cmake .. -G "Visual Studio 17 2022" -DCMAKE_SYSTEM_VERSION="10.0" -DDEV_TEST_SYNC=ON -DDEV_WITH_ASAN=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
& "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Msbuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=Debug p2pool.vcxproj
- name: Run p2pool
@@ -362,7 +363,7 @@ jobs:
start python ../../tests/src/stratum_dummy.py 1
start python ../../tests/src/stratum_dummy.py 2
start python ../../tests/src/stratum_dummy.py 3
p2pool.exe --host xmr.support --rpc-port 18081 --zmq-port 18083 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
p2pool.exe --host node.monerodevs.org --rpc-port 18089 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg ${{ secrets.MM_PARAMS }} --mini --out-peers 200 --data-api data --local-api --loglevel 6
- name: Check p2pool.log
run: |
@@ -395,7 +396,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -G "Visual Studio 17 2022" -DCMAKE_SYSTEM_VERSION="10.0" -DDEV_TEST_SYNC=ON -DDEV_TRACK_MEMORY=ON
cmake .. -G "Visual Studio 17 2022" -DCMAKE_SYSTEM_VERSION="10.0" -DDEV_TEST_SYNC=ON -DDEV_TRACK_MEMORY=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
& "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Msbuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=RelWithDebInfo p2pool.vcxproj
- name: Run p2pool
@@ -405,7 +406,7 @@ jobs:
Start-Process python -ArgumentList "../../tests/src/stratum_dummy.py 1"
Start-Process python -ArgumentList "../../tests/src/stratum_dummy.py 2"
Start-Process python -ArgumentList "../../tests/src/stratum_dummy.py 3"
./p2pool.exe --host xmr.support --rpc-port 18081 --zmq-port 18083 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
./p2pool.exe --host node.monerodevs.org --rpc-port 18089 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg ${{ secrets.MM_PARAMS }} --mini --out-peers 200 --data-api data --local-api --loglevel 6
- name: Check p2pool.log
run: |
+1
View File
@@ -1,2 +1,3 @@
.vscode
build
logs
+34 -22
View File
@@ -17,7 +17,9 @@ option(WITH_RANDOMX "Include the RandomX library in the build. If this is turned
option(WITH_LTO "Use link-time compiler optimization (if linking fails for you, run cmake with -DWITH_LTO=OFF)" ON)
option(WITH_UPNP "Include UPnP support. If this is turned off, p2pool will not be able to configure port forwarding on UPnP-enabled routers." ON)
option(WITH_GRPC "Include gRPC support. If this is turned off, p2pool will not be able to merge mine with Tari." ON)
option(WITH_TLS "Include TLS support. If this is turned off, p2pool will not support Stratum TLS connections." ON)
option(WITH_TLS "Include TLS support. If this is turned off, p2pool will not support Stratum TLS connections, and lack many other security features. It's recommended to keep it ON!" ON)
option(WITH_MERGE_MINING_DONATION "Merge mine donations to the author. This doesn't affect your hashrate or payouts in any way - only unused merge mining capacity will be utilised. If you merge mine yourself, your settings will take priority." ON)
option(DEV_TEST_SYNC "[Developer only] Sync test, stop p2pool after sync is complete" OFF)
option(DEV_WITH_TSAN "[Developer only] Compile with thread sanitizer" OFF)
@@ -56,6 +58,10 @@ if (WITH_UPNP)
set(LIBS ${LIBS} libminiupnpc-static)
endif()
if (WITH_MERGE_MINING_DONATION)
add_definitions(-DWITH_MERGE_MINING_DONATION)
endif()
if (DEV_TEST_SYNC)
add_definitions(-DDEV_TEST_SYNC)
endif()
@@ -250,22 +256,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang)
find_library(CURL_LIBRARY NAMES curl)
endif()
endif()
find_library(SODIUM_LIBRARY sodium)
endif()
find_library(PGM_LIBRARY pgm)
find_library(NORM_LIBRARY norm)
if (PGM_LIBRARY)
set(LIBS ${LIBS} ${PGM_LIBRARY})
endif()
if (NORM_LIBRARY)
set(LIBS ${LIBS} ${NORM_LIBRARY})
endif()
if (SODIUM_LIBRARY)
set(LIBS ${LIBS} ${SODIUM_LIBRARY})
endif()
if(APPLE)
@@ -345,6 +335,16 @@ int main(int argc, char* argv[])
return 0;
}" HAVE_RES_QUERY)
check_c_source_compiles("
#define _GNU_SOURCE
#include <pthread.h>
int main()
{
pthread_setname_np(pthread_self(), \"Main\");
return 0;
}" HAVE_PTHREAD_SETNAME_NP)
set(CMAKE_REQUIRED_LIBRARIES)
if (HAVE_BUILTIN_CLZLL)
@@ -366,12 +366,16 @@ if (HAVE_RES_QUERY)
endif()
endif()
if (HAVE_PTHREAD_SETNAME_NP)
add_definitions(/DHAVE_PTHREAD_SETNAME_NP)
endif()
add_definitions("-DRAPIDJSON_PARSE_DEFAULT_FLAGS=kParseTrailingCommasFlag")
add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES})
if (STATIC_BINARY OR STATIC_LIBS)
if (NOT (DEV_WITH_TSAN OR DEV_WITH_MSAN OR DEV_WITH_UBSAN OR DEV_WITH_ASAN))
if ((CMAKE_BUILD_TYPE STREQUAL "Release") AND (NOT (DEV_WITH_TSAN OR DEV_WITH_MSAN OR DEV_WITH_UBSAN OR DEV_WITH_ASAN)))
if (WIN32)
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} "${CMAKE_PROJECT_NAME}.exe")
else()
@@ -415,6 +419,10 @@ if (STATIC_BINARY OR STATIC_LIBS)
set(STATIC_LIBS ${STATIC_LIBS} ssl crypto)
endif()
if ((CMAKE_CXX_COMPILER_ID MATCHES GNU) AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9))
set(STATIC_LIBS ${STATIC_LIBS} stdc++fs)
endif()
target_link_libraries(${CMAKE_PROJECT_NAME}
"${CMAKE_SOURCE_DIR}/external/src/libzmq/build/lib/libzmq.a"
"${CMAKE_SOURCE_DIR}/external/src/libuv/build/libuv.a"
@@ -428,12 +436,16 @@ else()
set(LIBS ${LIBS} ssl crypto)
endif()
if ((CMAKE_CXX_COMPILER_ID MATCHES GNU) AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9))
set(LIBS ${LIBS} stdc++fs)
endif()
target_link_libraries(${CMAKE_PROJECT_NAME} debug ${ZMQ_LIBRARY_DEBUG} debug ${UV_LIBRARY_DEBUG} debug ${CURL_LIBRARY_DEBUG} optimized ${ZMQ_LIBRARY} optimized ${UV_LIBRARY} optimized ${CURL_LIBRARY} ${LIBS})
endif()
message(STATUS "Summary of build options:
C compiler: ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID})
CXX compiler: ${CMAKE_CXX_COMPILER} (${CMAKE_CXX_COMPILER_ID})
C_FLAGS: ${CMAKE_C_FLAGS}
CXX_FLAGS: ${CMAKE_CXX_FLAGS}
C compiler: ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID})
CXX compiler: ${CMAKE_CXX_COMPILER} (${CMAKE_CXX_COMPILER_ID})
C_FLAGS: ${CMAKE_C_FLAGS}
CXX_FLAGS: ${CMAKE_CXX_FLAGS}
")
+34 -9
View File
@@ -75,14 +75,13 @@ First you need to find a pool share. This share will stay in [PPLNS](https://en.
## Monero version support
- The latest Monero network upgrade happened on August 13th, 2022 (block 2,688,888).
- The latest P2Pool network upgrade happened on March 18th, 2023 at 21:00 UTC.
- Next P2Pool network upgrade will happen on October 12th, 2024 at 20:00 UTC.
- The latest P2Pool network upgrade happened on October 12th, 2024 at 20:00 UTC.
In order to continue mining on P2Pool, you must update both Monero and P2Pool software to the latest available versions as soon as they are released.
|Monero protocol version|Required Monero software version|Required P2Pool version
|-|-|-|
|v15, v16 (active after August 13th, 2022)|v0.18.0.0 or newer, v0.18.3.4 is recommended|v4.0 or newer
|v15, v16 (active after August 13th, 2022)|v0.18.0.0 or newer, v0.18.4.0 is recommended|v4.0 or newer
## How to mine on P2Pool
@@ -111,7 +110,7 @@ In order to continue mining on P2Pool, you must update both Monero and P2Pool so
### Merge mining
Merge mining will be available in P2Pool after the fork on October 12th, 2024. Version 4.0 or newer is required to use it.
Merge mining is available in P2Pool since the fork that happened on October 12th, 2024. Version 4.0 or newer is required to use it.
- Blockchains that will support [Merge mining RPC API](https://github.com/SChernykh/p2pool/blob/master/docs/MERGE_MINING.MD#proposed-rpc-api)
- [Townforge](https://townforge.net/) supports it in their [tmp-mm branch](https://git.townforge.net/townforge/townforge/src/branch/tmp-mm) (not released yet)
@@ -120,11 +119,27 @@ Merge mining will be available in P2Pool after the fork on October 12th, 2024. V
p2pool.exe --wallet YOUR_MONERO_WALLET_ADDRESS --merge-mine IP:port YOUR_WALLET_ADDRESS_ON_ANOTHER_BLOCKCHAIN
```
- [Tari](https://www.tari.com/) uses their own gRPC API and requires a different command line:
```
p2pool.exe --wallet YOUR_MONERO_WALLET_ADDRESS --merge-mine tari://IP:port TARI_WALLET_ADDRESS
```
Merge mining is available for testing in Tari's [v1.0.0-pre.14 release](https://github.com/tari-project/tari/releases/tag/v1.0.0-pre.14) (Esmeralda testnet).
### Tari merge mining
[Tari](https://www.tari.com/) uses their own gRPC API and requires a different command line:
```
./p2pool --wallet YOUR_MONERO_WALLET_ADDRESS --merge-mine tari://TARI_NODE_IP:18102 TARI_WALLET_ADDRESS
```
and on the Tari side
```
./minotari_node --grpc-enabled --mining-enabled
```
TARI_NODE_IP is 127.0.0.1 if you run both on the same machine (recommended).
Merge mining is available on Tari's mainnet:
- Download [Tari suite](https://github.com/tari-project/tari/releases/latest) for your OS
- Run Minotari node and wait until in synchronizes
- Run Minotari console wallet to create a Tari wallet
- Copy the interactive wallet address from the "Receive" tab of the wallet
- Paste it into the P2Pool command line above
- Everything is ready now to start merge mining Monero and Tari!
Note that Tari will be mined in solo mode (only full Tari blocks can be mined for now). This doesn't affect P2Pool payouts - they will stay the same.
### GNU/Linux
@@ -349,3 +364,13 @@ If you'd like to support further development of Monero P2Pool, you're welcome to
```
44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg
```
Starting from v4.6, P2Pool will also have an ability to merge mine donations for the author.
Note that this will not affect your hashrate or payouts in any way. P2Pool will always (100% of the time) keep mining to your configured Monero wallet address, but it might also use the available merge mining capacity to donate to the author.
If you merge mine yourself, your settings will take priority.
The merge mining donation runs without a donation server - there is no "phoning home" to a server, everything is done through the P2Pool's network in a decentralized way.
To opt out of this, build P2Pool with `-DWITH_MERGE_MINING_DONATION=OFF` in cmake command line. Due to the architecture of the decentralized P2Pool network, your node will still relay donation messages to other nodes even if you opted out (but it will not process them).
+48 -12
View File
@@ -17,23 +17,33 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
set(GENERAL_FLAGS "${GENERAL_FLAGS} -fno-omit-frame-pointer -fsanitize=address")
endif()
set(WARNING_FLAGS "-Wall -Wextra -Wcast-qual -Wlogical-op -Wundef -Wformat=2 -Wpointer-arith -Werror -Wno-error=inline")
set(WARNING_FLAGS "-Wall -Wextra -Wcast-qual -Wlogical-op -Wundef -Wformat=2 -Wpointer-arith -Werror -Wno-error=inline -Wno-error=unused-function -Wno-error=strict-overflow")
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.5.0)
set(WARNING_FLAGS "${WARNING_FLAGS} -Wstrict-overflow=2")
endif()
if (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15))
set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-error=cpp")
endif()
if (DISABLE_WARNINGS)
set(WARNING_FLAGS "-w")
endif()
if (DEV_WITH_TSAN OR DEV_WITH_UBSAN OR DEV_WITH_ASAN OR DEV_DEBUG)
set(OPTIMIZATION_FLAGS "-Og -g -ftrapv")
if (DEV_WITH_TSAN OR DEV_WITH_UBSAN OR DEV_WITH_ASAN OR DEV_DEBUG OR (CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
add_definitions(-DDEBUG_BUILD)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(OPTIMIZATION_FLAGS "-O0")
else()
set(OPTIMIZATION_FLAGS "-Og")
endif()
set(OPTIMIZATION_FLAGS "${OPTIMIZATION_FLAGS} -g3 -ftrapv")
else()
set(OPTIMIZATION_FLAGS "-O3 -ffast-math -s")
endif()
if (WITH_LTO)
if (WITH_LTO AND (CMAKE_BUILD_TYPE STREQUAL "Release"))
set(OPTIMIZATION_FLAGS "${OPTIMIZATION_FLAGS} -flto=auto -fuse-linker-plugin")
endif()
@@ -42,10 +52,16 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GENERAL_FLAGS} ${WARNING_FLAGS} ${OPTIMIZATION_FLAGS}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${GENERAL_FLAGS} ${WARNING_FLAGS} ${OPTIMIZATION_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "")
set(CMAKE_C_FLAGS_RELEASE "")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "")
set(CMAKE_C_FLAGS_MINSIZEREL "")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GENERAL_FLAGS} ${WARNING_FLAGS} ${OPTIMIZATION_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${GENERAL_FLAGS} ${WARNING_FLAGS} ${OPTIMIZATION_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "")
set(CMAKE_CXX_FLAGS_RELEASE "")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "")
set(CMAKE_CXX_FLAGS_MINSIZEREL "")
if (WIN32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
@@ -66,6 +82,10 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
set(WARNING_FLAGS "/W0")
endif()
if (DEV_DEBUG OR (CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
add_definitions(-DDEBUG_BUILD)
endif()
set(CMAKE_C_FLAGS_DEBUG "${GENERAL_FLAGS} ${WARNING_FLAGS} ${SECURITY_FLAGS} /Od /Ob0 /Zi /MTd")
set(CMAKE_CXX_FLAGS_DEBUG "${GENERAL_FLAGS} ${WARNING_FLAGS} ${SECURITY_FLAGS} /Od /Ob0 /Zi /MTd")
@@ -93,25 +113,41 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
set(GENERAL_FLAGS "${GENERAL_FLAGS} -mfix-cortex-a53-835769")
endif()
set(WARNING_FLAGS "-Wall -Wextra -Wno-undefined-internal -Wunreachable-code-aggressive -Wmissing-prototypes -Wmissing-variable-declarations -Werror")
set(WARNING_FLAGS "-Wall -Wextra -Wno-unused-function -Wno-undefined-internal -Wunreachable-code-aggressive -Wmissing-prototypes -Wmissing-variable-declarations -Werror")
if (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 20))
set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-error=cpp")
endif()
if (DISABLE_WARNINGS)
set(WARNING_FLAGS "-w")
endif()
if (DEV_WITH_MSAN OR DEV_DEBUG)
set(OPTIMIZATION_FLAGS "-Og -g -ftrapv")
if (DEV_WITH_MSAN OR DEV_DEBUG OR (CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
add_definitions(-DDEBUG_BUILD)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(OPTIMIZATION_FLAGS "-O0")
else()
set(OPTIMIZATION_FLAGS "-Og")
endif()
set(OPTIMIZATION_FLAGS "${OPTIMIZATION_FLAGS} -g3 -ftrapv")
else()
set(OPTIMIZATION_FLAGS "-O3 -ffast-math -funroll-loops -fmerge-all-constants")
endif()
if (WITH_LTO)
if (WITH_LTO AND (CMAKE_BUILD_TYPE STREQUAL "Release"))
set(OPTIMIZATION_FLAGS "${OPTIMIZATION_FLAGS} -flto")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GENERAL_FLAGS} ${WARNING_FLAGS} ${OPTIMIZATION_FLAGS}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${GENERAL_FLAGS} ${WARNING_FLAGS} ${OPTIMIZATION_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "")
set(CMAKE_C_FLAGS_RELEASE "")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "")
set(CMAKE_C_FLAGS_MINSIZEREL "")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GENERAL_FLAGS} ${WARNING_FLAGS} ${OPTIMIZATION_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${GENERAL_FLAGS} ${WARNING_FLAGS} ${OPTIMIZATION_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "")
set(CMAKE_CXX_FLAGS_RELEASE "")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "")
set(CMAKE_CXX_FLAGS_MINSIZEREL "")
endif()
+8
View File
@@ -0,0 +1,8 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSTEM_PROCESSOR riscv64)
set(CMAKE_C_COMPILER /usr/bin/riscv64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER /usr/bin/riscv64-linux-gnu-g++)
set(CMAKE_STRIP /usr/bin/riscv64-linux-gnu-strip)
+1 -1
View File
@@ -1,5 +1,5 @@
@echo off
"..\cppcheck-main\bin\cppcheck.exe" ../src/*.cpp -D__cppcheck__ -DSIZE_MAX=UINT64_MAX -DRAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN -D_WIN32=1 -D_WIN64=1 -DWIN32=1 -D_WINDOWS=1 -DNDEBUG=1 -DWITH_GRPC=1 -DPROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII=0 -DWITH_RANDOMX=1 -DWITH_UPNP=1 -DCURL_STATICLIB=1 -DWIN32_LEAN_AND_MEAN=1 -D_WIN32_WINNT=0x0600 -D_DISABLE_VECTOR_ANNOTATION=1 -D_DISABLE_STRING_ANNOTATION=1 -DZMQ_STATIC=1 -DHAVE_BITSCANREVERSE64=1 -DRAPIDJSON_PARSE_DEFAULT_FLAGS=kParseTrailingCommasFlag -DMINIUPNP_STATICLIB=1 -DCARES_STATICLIB=1 -DCMAKE_INTDIR="Release" -D__SSE2__=1 -D_MSC_VER=1929 --platform=win64 --std=c++17 --enable=all --inconclusive --inline-suppr --template="{file}:{line}:{id}{inconclusive: INCONCLUSIVE} {message}" --includes-file=includes.txt --suppressions-list=suppressions.txt --output-file=errors_full.txt --max-ctu-depth=3 --check-level=exhaustive --checkers-report=checkers_report.txt
"..\cppcheck-main\bin\cppcheck.exe" ../src/*.cpp -D__cppcheck__ -DSIZE_MAX=UINT64_MAX -DRAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN -D_WIN32=1 -D_WIN64=1 -DWIN32=1 -D_WINDOWS=1 -DNDEBUG=1 -DWITH_GRPC=1 -DPROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII=0 -DWITH_RANDOMX=1 -DWITH_UPNP=1 -DWITH_TLS=1 -DWITH_MERGE_MINING_DONATION=1 -DCURL_STATICLIB=1 -DWIN32_LEAN_AND_MEAN=1 -D_WIN32_WINNT=0x0600 -D_DISABLE_VECTOR_ANNOTATION=1 -D_DISABLE_STRING_ANNOTATION=1 -DZMQ_STATIC=1 -DHAVE_BITSCANREVERSE64=1 -DRAPIDJSON_PARSE_DEFAULT_FLAGS=kParseTrailingCommasFlag -DMINIUPNP_STATICLIB=1 -DCARES_STATICLIB=1 -DCMAKE_INTDIR="Release" -D__SSE2__=1 -D_MSC_VER=1929 --platform=win64 --std=c++17 --enable=all --inconclusive --inline-suppr --template="{file}:{line}:{id}{inconclusive: INCONCLUSIVE} {message}" --includes-file=includes.txt --suppressions-list=suppressions.txt --output-file=errors_full.txt --max-ctu-depth=3 --check-level=exhaustive --checkers-report=checkers_report.txt
findstr /V /C:"external\src" errors_full.txt > errors_filtered0.txt
findstr /V /C:":checkersReport" errors_filtered0.txt > errors_filtered.txt
+1 -1
View File
@@ -1,3 +1,3 @@
npyscreen==4.10.5
MarkupSafe==2.0.1
jinja2==3.1.5
jinja2==3.1.6
+93
View File
@@ -0,0 +1,93 @@
## Setting up P2Pool as a service controlled by a RC script (FreeBSD, and possibly other)
In order to use this RC script, it is required to create a `p2pool` user account on the system for this service. An example **passwd(5)** line for this user would be:
```
p2pool:*:818:818::0:0:Monero P2Pool:/var/db/p2pool:/usr/sbin/nologin
```
Also an example **group(5)** line:
```
p2pool:*:818:
```
When creating such an user and a group, make sure the UID and GID aren't being used by any other user/group in the system. The home directory of the user will be used as the data directory of P2Pool; set it to your desired location as needed.
The RC script assumes the P2Pool executable is installed as `/usr/local/bin/p2pool`.
### /usr/local/etc/rc.d/p2pool
```sh
#!/bin/sh
# PROVIDE: p2pool
# REQUIRE: LOGIN FILESYSTEMS
# KEYWORD: shutdown
. /etc/rc.subr
name=p2pool
rcvar=p2pool_enable
load_rc_config $name
: ${p2pool_enable:="NO"} ${p2pool_local_api:="NO"}
[ -z "$p2pool_wallet" ] && exit 1
p2pool_user=p2pool
p2pool_home="`getent passwd ${p2pool_user} | cut -d : -f 6`"
[ -z "$p2pool_home" ] && exit 1
p2pool_env="HOME=$p2pool_home"
p2pool_chdir="$p2pool_home"
procname=/usr/local/bin/p2pool
pidfile="$p2pool_home/p2pool.pid"
command=/usr/sbin/daemon
flags="-p ${pidfile} -f -- ${procname} ${p2pool_flags} --data-dir ${p2pool_home} --wallet ${p2pool_wallet}"
[ -n "${p2pool_api_path}" ] && flags="${flags} --data-api ${p2pool_api_path}"
if checkyesno p2pool_local_api; then
if [ -n "${p2pool_api_path}" ]; then
flags="${flags} --local-api"
else
echo 'Warning: p2pool_local_api="YES" requires p2pool_api_path being set, ignoring' 1>&2
fi
fi
start_precmd="p2pool_prestart"
stop_postcmd="rm -f ${pidfile}"
p2pool_prestart() {
if [ -n "${p2pool_api_path}" ]; then
[ -d "${p2pool_api_path}" ] || mkdir -p "${p2pool_api_path}"
gid="`getent passwd ${p2pool_user} | cut -d : -f 4`"
chown ${p2pool_user}:${gid} "${p2pool_api_path}"
fi
}
run_rc_command "$1"
```
### Configuration variables in /etc/rc.conf (or /etc/rc.conf.local)
* `p2pool_enable` Set to `YES` to enable this service; required.
* `p2pool_wallet` Your wallet address; required.
* `p2pool_api_path` Path to API directory (See p2pool option `--data-api`), this directory will be created automatically if not already exists, on service startup; optional.
* `p2pool_local_api` Set to `YES` to enable creation of `local` path in API directory (See p2pool option `--local-api`), requires `p2pool_api_path` also being set; optional.
* `p2pool_flags` Additional options you want to pass to p2pool; optional.
#### Example
```sh
p2pool_enable="YES"
p2pool_wallet="44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg"
p2pool_api_path="/tmp/p2pool-api"
p2pool_local_api="YES"
p2pool_flags="--host 127.0.0.1 --in-peers 200"
```
## /usr/local/etc/newsyslog.conf.d/p2pool.conf (optional)
You can create this drop-in **newsyslog(8)** configuration file to periodically rotate the P2Pool log file. The drop-in location `/usr/local/etc/newsyslog.conf.d/` assumes that `/etc/newsyslog.conf` contains an `include` directive for searching drop-in configuration files in it.
This example assumes `/var/db/p2pool` as your P2Pool data directory.
```
# log file owner:group mode count size (KiB) when flags pid file signal
/var/db/p2pool/p2pool.log p2pool:p2pool 640 16 65536 @0101T BEJ /var/db/p2pool/p2pool.pid SIGUSR1
```
You should adjust the `count`, `size`, `when` and/or `flags` fields to fit your needs.
+25 -11
View File
@@ -8,6 +8,7 @@
--stratum Comma-separated list of IP:port for stratum server to listen on
--p2p Comma-separated list of IP:port for p2p server to listen on
--addpeers Comma-separated list of IP:port of other p2pool nodes to connect to
--stratum-ban-time N Number of seconds to ban misbehaving stratum client, default is 600
--light-mode Don't allocate RandomX dataset, saves 2GB of RAM
--loglevel Verbosity of the log, integer number between 0 and 6
--data-dir Path to store general p2pool files (log, cache, peer data, etc.), default is current directory
@@ -22,6 +23,7 @@
--in-peers N Maximum number of incoming connections for p2p server (any value between 10 and 450)
--start-mining N Start built-in miner using N threads (any value between 1 and 64)
--mini Connect to p2pool-mini sidechain. Note that it will also change default p2p port from 37889 to 37888
--nano Connect to p2pool-nano sidechain. Note that it will also change default p2p port from 37889 to 37890
--no-autodiff Disable automatic difficulty adjustment for miners connected to stratum (WARNING: incompatible with Nicehash and MRR)
--rpc-login Specify username[:password] required for Monero RPC server
--socks5 Specify IP:port of a SOCKS5 proxy to use for outgoing connections
@@ -60,7 +62,7 @@ p2pool.exe --host 127.0.0.1 --host node.monerodevs.org --rpc-port 18089 --zmq-po
### Merge mining
Merge mining will be available in P2Pool after the fork on October 12th, 2024. Version 4.0 or newer is required to use it.
Merge mining is available in P2Pool since the fork that happened on October 12th, 2024. Version 4.0 or newer is required to use it.
- Blockchains that will support [Merge mining RPC API](https://github.com/SChernykh/p2pool/blob/master/docs/MERGE_MINING.MD#proposed-rpc-api)
- [Townforge](https://townforge.net/) supports it in their [tmp-mm branch](https://git.townforge.net/townforge/townforge/src/branch/tmp-mm) (not released yet)
@@ -69,15 +71,27 @@ Merge mining will be available in P2Pool after the fork on October 12th, 2024. V
p2pool.exe --wallet YOUR_MONERO_WALLET_ADDRESS --merge-mine IP:port YOUR_WALLET_ADDRESS_ON_ANOTHER_BLOCKCHAIN
```
- [Tari](https://www.tari.com/) uses their own gRPC API and requires a different command line:
```
./p2pool --wallet YOUR_MONERO_WALLET_ADDRESS --merge-mine tari://IP:port TARI_WALLET_ADDRESS
```
and on the Tari side
```
./minotari_node --grpc-enabled --mining-enabled
```
Merge mining is available for testing in Tari's [latest release](https://github.com/tari-project/tari/releases) (Esmeralda testnet).
### Tari merge mining
[Tari](https://www.tari.com/) uses their own gRPC API and requires a different command line:
```
./p2pool --wallet YOUR_MONERO_WALLET_ADDRESS --merge-mine tari://TARI_NODE_IP:18102 TARI_WALLET_ADDRESS
```
and on the Tari side
```
./minotari_node --grpc-enabled --mining-enabled
```
TARI_NODE_IP is 127.0.0.1 if you run both on the same machine (recommended).
Merge mining is available on Tari's mainnet:
- Download [Tari suite](https://github.com/tari-project/tari/releases/latest) for your OS
- Run Minotari node and wait until in synchronizes
- Run Minotari console wallet to create a Tari wallet
- Copy the interactive wallet address from the "Receive" tab of the wallet
- Paste it into the P2Pool command line above
- Everything is ready now to start merge mining Monero and Tari!
Note that Tari will be mined in solo mode (only full Tari blocks can be mined for now). This doesn't affect P2Pool payouts - they will stay the same.
### TLS
@@ -101,4 +115,4 @@ P2Pool supports certificate pinning on RPC-SSL connections via `--rpc-ssl-finger
openssl x509 -in rpc_ssl.crt -pubkey -noout -inform pem | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
```
By default, `rpc_ssl.crt` can be found in Monero data directory: `/home/username/.bitmonero/rpc_ssl.crt` on Linux and `C:\ProgramData\bitmonero\rpc_ssl.crt` on Windows.
By default, `rpc_ssl.crt` can be found in Monero data directory: `/home/username/.bitmonero/rpc_ssl.crt` on Linux and `C:\ProgramData\bitmonero\rpc_ssl.crt` on Windows.
+27
View File
@@ -18,3 +18,30 @@ start_mining **T**|start mining (**T** is the number of threads to use, must be
stop_mining|stop mining
exit|terminate p2pool
version|show p2pool version
### Non-interactive console access
It's possible to send console commands via a local TCP connection. For this, you need to enable the API: `--data-api api --local-api`.
A sample Python script that sends console commands to P2Pool via TCP:
```
import sys
import socket
import json
with open('api/local/console', 'r') as file:
data = json.load(file)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('127.0.0.1', data['tcp_port']))
command = data['cookie'];
command += sys.argv[1];
command += '\n';
s.sendall(command.encode('utf-8'))
s.close()
```
Run it in P2Pool's directory: `python3 ./p2pool_cmd.py status`
+42
View File
@@ -59,6 +59,7 @@ static const char* BaseNode_method_names[] = {
"/tari.rpc.BaseNode/GetShardKey",
"/tari.rpc.BaseNode/GetTemplateRegistrations",
"/tari.rpc.BaseNode/GetSideChainUtxos",
"/tari.rpc.BaseNode/GetNetworkState",
};
std::unique_ptr< BaseNode::Stub> BaseNode::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) {
@@ -104,6 +105,7 @@ BaseNode::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel,
, rpcmethod_GetShardKey_(BaseNode_method_names[33], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel)
, rpcmethod_GetTemplateRegistrations_(BaseNode_method_names[34], options.suffix_for_stats(),::grpc::internal::RpcMethod::SERVER_STREAMING, channel)
, rpcmethod_GetSideChainUtxos_(BaseNode_method_names[35], options.suffix_for_stats(),::grpc::internal::RpcMethod::SERVER_STREAMING, channel)
, rpcmethod_GetNetworkState_(BaseNode_method_names[36], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel)
{}
::grpc::ClientReader< ::tari::rpc::BlockHeaderResponse>* BaseNode::Stub::ListHeadersRaw(::grpc::ClientContext* context, const ::tari::rpc::ListHeadersRequest& request) {
@@ -850,6 +852,29 @@ void BaseNode::Stub::async::GetSideChainUtxos(::grpc::ClientContext* context, co
return ::grpc::internal::ClientAsyncReaderFactory< ::tari::rpc::GetSideChainUtxosResponse>::Create(channel_.get(), cq, rpcmethod_GetSideChainUtxos_, context, request, false, nullptr);
}
::grpc::Status BaseNode::Stub::GetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::tari::rpc::GetNetworkStateResponse* response) {
return ::grpc::internal::BlockingUnaryCall< ::tari::rpc::GetNetworkStateRequest, ::tari::rpc::GetNetworkStateResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_GetNetworkState_, context, request, response);
}
void BaseNode::Stub::async::GetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest* request, ::tari::rpc::GetNetworkStateResponse* response, std::function<void(::grpc::Status)> f) {
::grpc::internal::CallbackUnaryCall< ::tari::rpc::GetNetworkStateRequest, ::tari::rpc::GetNetworkStateResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_GetNetworkState_, context, request, response, std::move(f));
}
void BaseNode::Stub::async::GetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest* request, ::tari::rpc::GetNetworkStateResponse* response, ::grpc::ClientUnaryReactor* reactor) {
::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_GetNetworkState_, context, request, response, reactor);
}
::grpc::ClientAsyncResponseReader< ::tari::rpc::GetNetworkStateResponse>* BaseNode::Stub::PrepareAsyncGetNetworkStateRaw(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::grpc::CompletionQueue* cq) {
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::tari::rpc::GetNetworkStateResponse, ::tari::rpc::GetNetworkStateRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_GetNetworkState_, context, request);
}
::grpc::ClientAsyncResponseReader< ::tari::rpc::GetNetworkStateResponse>* BaseNode::Stub::AsyncGetNetworkStateRaw(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::grpc::CompletionQueue* cq) {
auto* result =
this->PrepareAsyncGetNetworkStateRaw(context, request, cq);
result->StartCall();
return result;
}
BaseNode::Service::Service() {
AddMethod(new ::grpc::internal::RpcServiceMethod(
BaseNode_method_names[0],
@@ -1211,6 +1236,16 @@ BaseNode::Service::Service() {
::grpc::ServerWriter<::tari::rpc::GetSideChainUtxosResponse>* writer) {
return service->GetSideChainUtxos(ctx, req, writer);
}, this)));
AddMethod(new ::grpc::internal::RpcServiceMethod(
BaseNode_method_names[36],
::grpc::internal::RpcMethod::NORMAL_RPC,
new ::grpc::internal::RpcMethodHandler< BaseNode::Service, ::tari::rpc::GetNetworkStateRequest, ::tari::rpc::GetNetworkStateResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
[](BaseNode::Service* service,
::grpc::ServerContext* ctx,
const ::tari::rpc::GetNetworkStateRequest* req,
::tari::rpc::GetNetworkStateResponse* resp) {
return service->GetNetworkState(ctx, req, resp);
}, this)));
}
BaseNode::Service::~Service() {
@@ -1468,6 +1503,13 @@ BaseNode::Service::~Service() {
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
::grpc::Status BaseNode::Service::GetNetworkState(::grpc::ServerContext* context, const ::tari::rpc::GetNetworkStateRequest* request, ::tari::rpc::GetNetworkStateResponse* response) {
(void) context;
(void) request;
(void) response;
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
} // namespace tari
} // namespace rpc
+161 -4
View File
@@ -367,6 +367,13 @@ class BaseNode final {
std::unique_ptr< ::grpc::ClientAsyncReaderInterface< ::tari::rpc::GetSideChainUtxosResponse>> PrepareAsyncGetSideChainUtxos(::grpc::ClientContext* context, const ::tari::rpc::GetSideChainUtxosRequest& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncReaderInterface< ::tari::rpc::GetSideChainUtxosResponse>>(PrepareAsyncGetSideChainUtxosRaw(context, request, cq));
}
virtual ::grpc::Status GetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::tari::rpc::GetNetworkStateResponse* response) = 0;
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::tari::rpc::GetNetworkStateResponse>> AsyncGetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::tari::rpc::GetNetworkStateResponse>>(AsyncGetNetworkStateRaw(context, request, cq));
}
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::tari::rpc::GetNetworkStateResponse>> PrepareAsyncGetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::tari::rpc::GetNetworkStateResponse>>(PrepareAsyncGetNetworkStateRaw(context, request, cq));
}
class async_interface {
public:
virtual ~async_interface() {}
@@ -462,6 +469,8 @@ class BaseNode final {
// Get templates
virtual void GetTemplateRegistrations(::grpc::ClientContext* context, const ::tari::rpc::GetTemplateRegistrationsRequest* request, ::grpc::ClientReadReactor< ::tari::rpc::GetTemplateRegistrationResponse>* reactor) = 0;
virtual void GetSideChainUtxos(::grpc::ClientContext* context, const ::tari::rpc::GetSideChainUtxosRequest* request, ::grpc::ClientReadReactor< ::tari::rpc::GetSideChainUtxosResponse>* reactor) = 0;
virtual void GetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest* request, ::tari::rpc::GetNetworkStateResponse* response, std::function<void(::grpc::Status)>) = 0;
virtual void GetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest* request, ::tari::rpc::GetNetworkStateResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0;
};
typedef class async_interface experimental_async_interface;
virtual class async_interface* async() { return nullptr; }
@@ -551,6 +560,8 @@ class BaseNode final {
virtual ::grpc::ClientReaderInterface< ::tari::rpc::GetSideChainUtxosResponse>* GetSideChainUtxosRaw(::grpc::ClientContext* context, const ::tari::rpc::GetSideChainUtxosRequest& request) = 0;
virtual ::grpc::ClientAsyncReaderInterface< ::tari::rpc::GetSideChainUtxosResponse>* AsyncGetSideChainUtxosRaw(::grpc::ClientContext* context, const ::tari::rpc::GetSideChainUtxosRequest& request, ::grpc::CompletionQueue* cq, void* tag) = 0;
virtual ::grpc::ClientAsyncReaderInterface< ::tari::rpc::GetSideChainUtxosResponse>* PrepareAsyncGetSideChainUtxosRaw(::grpc::ClientContext* context, const ::tari::rpc::GetSideChainUtxosRequest& request, ::grpc::CompletionQueue* cq) = 0;
virtual ::grpc::ClientAsyncResponseReaderInterface< ::tari::rpc::GetNetworkStateResponse>* AsyncGetNetworkStateRaw(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::grpc::CompletionQueue* cq) = 0;
virtual ::grpc::ClientAsyncResponseReaderInterface< ::tari::rpc::GetNetworkStateResponse>* PrepareAsyncGetNetworkStateRaw(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::grpc::CompletionQueue* cq) = 0;
};
class Stub final : public StubInterface {
public:
@@ -831,6 +842,13 @@ class BaseNode final {
std::unique_ptr< ::grpc::ClientAsyncReader< ::tari::rpc::GetSideChainUtxosResponse>> PrepareAsyncGetSideChainUtxos(::grpc::ClientContext* context, const ::tari::rpc::GetSideChainUtxosRequest& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncReader< ::tari::rpc::GetSideChainUtxosResponse>>(PrepareAsyncGetSideChainUtxosRaw(context, request, cq));
}
::grpc::Status GetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::tari::rpc::GetNetworkStateResponse* response) override;
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::tari::rpc::GetNetworkStateResponse>> AsyncGetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::tari::rpc::GetNetworkStateResponse>>(AsyncGetNetworkStateRaw(context, request, cq));
}
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::tari::rpc::GetNetworkStateResponse>> PrepareAsyncGetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::tari::rpc::GetNetworkStateResponse>>(PrepareAsyncGetNetworkStateRaw(context, request, cq));
}
class async final :
public StubInterface::async_interface {
public:
@@ -894,6 +912,8 @@ class BaseNode final {
void GetShardKey(::grpc::ClientContext* context, const ::tari::rpc::GetShardKeyRequest* request, ::tari::rpc::GetShardKeyResponse* response, ::grpc::ClientUnaryReactor* reactor) override;
void GetTemplateRegistrations(::grpc::ClientContext* context, const ::tari::rpc::GetTemplateRegistrationsRequest* request, ::grpc::ClientReadReactor< ::tari::rpc::GetTemplateRegistrationResponse>* reactor) override;
void GetSideChainUtxos(::grpc::ClientContext* context, const ::tari::rpc::GetSideChainUtxosRequest* request, ::grpc::ClientReadReactor< ::tari::rpc::GetSideChainUtxosResponse>* reactor) override;
void GetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest* request, ::tari::rpc::GetNetworkStateResponse* response, std::function<void(::grpc::Status)>) override;
void GetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest* request, ::tari::rpc::GetNetworkStateResponse* response, ::grpc::ClientUnaryReactor* reactor) override;
private:
friend class Stub;
explicit async(Stub* stub): stub_(stub) { }
@@ -989,6 +1009,8 @@ class BaseNode final {
::grpc::ClientReader< ::tari::rpc::GetSideChainUtxosResponse>* GetSideChainUtxosRaw(::grpc::ClientContext* context, const ::tari::rpc::GetSideChainUtxosRequest& request) override;
::grpc::ClientAsyncReader< ::tari::rpc::GetSideChainUtxosResponse>* AsyncGetSideChainUtxosRaw(::grpc::ClientContext* context, const ::tari::rpc::GetSideChainUtxosRequest& request, ::grpc::CompletionQueue* cq, void* tag) override;
::grpc::ClientAsyncReader< ::tari::rpc::GetSideChainUtxosResponse>* PrepareAsyncGetSideChainUtxosRaw(::grpc::ClientContext* context, const ::tari::rpc::GetSideChainUtxosRequest& request, ::grpc::CompletionQueue* cq) override;
::grpc::ClientAsyncResponseReader< ::tari::rpc::GetNetworkStateResponse>* AsyncGetNetworkStateRaw(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::grpc::CompletionQueue* cq) override;
::grpc::ClientAsyncResponseReader< ::tari::rpc::GetNetworkStateResponse>* PrepareAsyncGetNetworkStateRaw(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::grpc::CompletionQueue* cq) override;
const ::grpc::internal::RpcMethod rpcmethod_ListHeaders_;
const ::grpc::internal::RpcMethod rpcmethod_GetHeaderByHash_;
const ::grpc::internal::RpcMethod rpcmethod_GetBlocks_;
@@ -1025,6 +1047,7 @@ class BaseNode final {
const ::grpc::internal::RpcMethod rpcmethod_GetShardKey_;
const ::grpc::internal::RpcMethod rpcmethod_GetTemplateRegistrations_;
const ::grpc::internal::RpcMethod rpcmethod_GetSideChainUtxos_;
const ::grpc::internal::RpcMethod rpcmethod_GetNetworkState_;
};
static std::unique_ptr<Stub> NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());
@@ -1100,6 +1123,7 @@ class BaseNode final {
// Get templates
virtual ::grpc::Status GetTemplateRegistrations(::grpc::ServerContext* context, const ::tari::rpc::GetTemplateRegistrationsRequest* request, ::grpc::ServerWriter< ::tari::rpc::GetTemplateRegistrationResponse>* writer);
virtual ::grpc::Status GetSideChainUtxos(::grpc::ServerContext* context, const ::tari::rpc::GetSideChainUtxosRequest* request, ::grpc::ServerWriter< ::tari::rpc::GetSideChainUtxosResponse>* writer);
virtual ::grpc::Status GetNetworkState(::grpc::ServerContext* context, const ::tari::rpc::GetNetworkStateRequest* request, ::tari::rpc::GetNetworkStateResponse* response);
};
template <class BaseClass>
class WithAsyncMethod_ListHeaders : public BaseClass {
@@ -1821,7 +1845,27 @@ class BaseNode final {
::grpc::Service::RequestAsyncServerStreaming(35, context, request, writer, new_call_cq, notification_cq, tag);
}
};
typedef WithAsyncMethod_ListHeaders<WithAsyncMethod_GetHeaderByHash<WithAsyncMethod_GetBlocks<WithAsyncMethod_GetBlockTiming<WithAsyncMethod_GetConstants<WithAsyncMethod_GetBlockSize<WithAsyncMethod_GetBlockFees<WithAsyncMethod_GetVersion<WithAsyncMethod_CheckForUpdates<WithAsyncMethod_GetTokensInCirculation<WithAsyncMethod_GetNetworkDifficulty<WithAsyncMethod_GetNewBlockTemplate<WithAsyncMethod_GetNewBlock<WithAsyncMethod_GetNewBlockWithCoinbases<WithAsyncMethod_GetNewBlockTemplateWithCoinbases<WithAsyncMethod_GetNewBlockBlob<WithAsyncMethod_SubmitBlock<WithAsyncMethod_SubmitBlockBlob<WithAsyncMethod_SubmitTransaction<WithAsyncMethod_GetSyncInfo<WithAsyncMethod_GetSyncProgress<WithAsyncMethod_GetTipInfo<WithAsyncMethod_SearchKernels<WithAsyncMethod_SearchUtxos<WithAsyncMethod_FetchMatchingUtxos<WithAsyncMethod_GetPeers<WithAsyncMethod_GetMempoolTransactions<WithAsyncMethod_TransactionState<WithAsyncMethod_Identify<WithAsyncMethod_GetNetworkStatus<WithAsyncMethod_ListConnectedPeers<WithAsyncMethod_GetMempoolStats<WithAsyncMethod_GetActiveValidatorNodes<WithAsyncMethod_GetShardKey<WithAsyncMethod_GetTemplateRegistrations<WithAsyncMethod_GetSideChainUtxos<Service > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > AsyncService;
template <class BaseClass>
class WithAsyncMethod_GetNetworkState : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
public:
WithAsyncMethod_GetNetworkState() {
::grpc::Service::MarkMethodAsync(36);
}
~WithAsyncMethod_GetNetworkState() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
::grpc::Status GetNetworkState(::grpc::ServerContext* /*context*/, const ::tari::rpc::GetNetworkStateRequest* /*request*/, ::tari::rpc::GetNetworkStateResponse* /*response*/) override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
void RequestGetNetworkState(::grpc::ServerContext* context, ::tari::rpc::GetNetworkStateRequest* request, ::grpc::ServerAsyncResponseWriter< ::tari::rpc::GetNetworkStateResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
::grpc::Service::RequestAsyncUnary(36, context, request, response, new_call_cq, notification_cq, tag);
}
};
typedef WithAsyncMethod_ListHeaders<WithAsyncMethod_GetHeaderByHash<WithAsyncMethod_GetBlocks<WithAsyncMethod_GetBlockTiming<WithAsyncMethod_GetConstants<WithAsyncMethod_GetBlockSize<WithAsyncMethod_GetBlockFees<WithAsyncMethod_GetVersion<WithAsyncMethod_CheckForUpdates<WithAsyncMethod_GetTokensInCirculation<WithAsyncMethod_GetNetworkDifficulty<WithAsyncMethod_GetNewBlockTemplate<WithAsyncMethod_GetNewBlock<WithAsyncMethod_GetNewBlockWithCoinbases<WithAsyncMethod_GetNewBlockTemplateWithCoinbases<WithAsyncMethod_GetNewBlockBlob<WithAsyncMethod_SubmitBlock<WithAsyncMethod_SubmitBlockBlob<WithAsyncMethod_SubmitTransaction<WithAsyncMethod_GetSyncInfo<WithAsyncMethod_GetSyncProgress<WithAsyncMethod_GetTipInfo<WithAsyncMethod_SearchKernels<WithAsyncMethod_SearchUtxos<WithAsyncMethod_FetchMatchingUtxos<WithAsyncMethod_GetPeers<WithAsyncMethod_GetMempoolTransactions<WithAsyncMethod_TransactionState<WithAsyncMethod_Identify<WithAsyncMethod_GetNetworkStatus<WithAsyncMethod_ListConnectedPeers<WithAsyncMethod_GetMempoolStats<WithAsyncMethod_GetActiveValidatorNodes<WithAsyncMethod_GetShardKey<WithAsyncMethod_GetTemplateRegistrations<WithAsyncMethod_GetSideChainUtxos<WithAsyncMethod_GetNetworkState<Service > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > AsyncService;
template <class BaseClass>
class WithCallbackMethod_ListHeaders : public BaseClass {
private:
@@ -2734,7 +2778,34 @@ class BaseNode final {
virtual ::grpc::ServerWriteReactor< ::tari::rpc::GetSideChainUtxosResponse>* GetSideChainUtxos(
::grpc::CallbackServerContext* /*context*/, const ::tari::rpc::GetSideChainUtxosRequest* /*request*/) { return nullptr; }
};
typedef WithCallbackMethod_ListHeaders<WithCallbackMethod_GetHeaderByHash<WithCallbackMethod_GetBlocks<WithCallbackMethod_GetBlockTiming<WithCallbackMethod_GetConstants<WithCallbackMethod_GetBlockSize<WithCallbackMethod_GetBlockFees<WithCallbackMethod_GetVersion<WithCallbackMethod_CheckForUpdates<WithCallbackMethod_GetTokensInCirculation<WithCallbackMethod_GetNetworkDifficulty<WithCallbackMethod_GetNewBlockTemplate<WithCallbackMethod_GetNewBlock<WithCallbackMethod_GetNewBlockWithCoinbases<WithCallbackMethod_GetNewBlockTemplateWithCoinbases<WithCallbackMethod_GetNewBlockBlob<WithCallbackMethod_SubmitBlock<WithCallbackMethod_SubmitBlockBlob<WithCallbackMethod_SubmitTransaction<WithCallbackMethod_GetSyncInfo<WithCallbackMethod_GetSyncProgress<WithCallbackMethod_GetTipInfo<WithCallbackMethod_SearchKernels<WithCallbackMethod_SearchUtxos<WithCallbackMethod_FetchMatchingUtxos<WithCallbackMethod_GetPeers<WithCallbackMethod_GetMempoolTransactions<WithCallbackMethod_TransactionState<WithCallbackMethod_Identify<WithCallbackMethod_GetNetworkStatus<WithCallbackMethod_ListConnectedPeers<WithCallbackMethod_GetMempoolStats<WithCallbackMethod_GetActiveValidatorNodes<WithCallbackMethod_GetShardKey<WithCallbackMethod_GetTemplateRegistrations<WithCallbackMethod_GetSideChainUtxos<Service > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > CallbackService;
template <class BaseClass>
class WithCallbackMethod_GetNetworkState : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
public:
WithCallbackMethod_GetNetworkState() {
::grpc::Service::MarkMethodCallback(36,
new ::grpc::internal::CallbackUnaryHandler< ::tari::rpc::GetNetworkStateRequest, ::tari::rpc::GetNetworkStateResponse>(
[this](
::grpc::CallbackServerContext* context, const ::tari::rpc::GetNetworkStateRequest* request, ::tari::rpc::GetNetworkStateResponse* response) { return this->GetNetworkState(context, request, response); }));}
void SetMessageAllocatorFor_GetNetworkState(
::grpc::MessageAllocator< ::tari::rpc::GetNetworkStateRequest, ::tari::rpc::GetNetworkStateResponse>* allocator) {
::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(36);
static_cast<::grpc::internal::CallbackUnaryHandler< ::tari::rpc::GetNetworkStateRequest, ::tari::rpc::GetNetworkStateResponse>*>(handler)
->SetMessageAllocator(allocator);
}
~WithCallbackMethod_GetNetworkState() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
::grpc::Status GetNetworkState(::grpc::ServerContext* /*context*/, const ::tari::rpc::GetNetworkStateRequest* /*request*/, ::tari::rpc::GetNetworkStateResponse* /*response*/) override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
virtual ::grpc::ServerUnaryReactor* GetNetworkState(
::grpc::CallbackServerContext* /*context*/, const ::tari::rpc::GetNetworkStateRequest* /*request*/, ::tari::rpc::GetNetworkStateResponse* /*response*/) { return nullptr; }
};
typedef WithCallbackMethod_ListHeaders<WithCallbackMethod_GetHeaderByHash<WithCallbackMethod_GetBlocks<WithCallbackMethod_GetBlockTiming<WithCallbackMethod_GetConstants<WithCallbackMethod_GetBlockSize<WithCallbackMethod_GetBlockFees<WithCallbackMethod_GetVersion<WithCallbackMethod_CheckForUpdates<WithCallbackMethod_GetTokensInCirculation<WithCallbackMethod_GetNetworkDifficulty<WithCallbackMethod_GetNewBlockTemplate<WithCallbackMethod_GetNewBlock<WithCallbackMethod_GetNewBlockWithCoinbases<WithCallbackMethod_GetNewBlockTemplateWithCoinbases<WithCallbackMethod_GetNewBlockBlob<WithCallbackMethod_SubmitBlock<WithCallbackMethod_SubmitBlockBlob<WithCallbackMethod_SubmitTransaction<WithCallbackMethod_GetSyncInfo<WithCallbackMethod_GetSyncProgress<WithCallbackMethod_GetTipInfo<WithCallbackMethod_SearchKernels<WithCallbackMethod_SearchUtxos<WithCallbackMethod_FetchMatchingUtxos<WithCallbackMethod_GetPeers<WithCallbackMethod_GetMempoolTransactions<WithCallbackMethod_TransactionState<WithCallbackMethod_Identify<WithCallbackMethod_GetNetworkStatus<WithCallbackMethod_ListConnectedPeers<WithCallbackMethod_GetMempoolStats<WithCallbackMethod_GetActiveValidatorNodes<WithCallbackMethod_GetShardKey<WithCallbackMethod_GetTemplateRegistrations<WithCallbackMethod_GetSideChainUtxos<WithCallbackMethod_GetNetworkState<Service > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > CallbackService;
typedef CallbackService ExperimentalCallbackService;
template <class BaseClass>
class WithGenericMethod_ListHeaders : public BaseClass {
@@ -3349,6 +3420,23 @@ class BaseNode final {
}
};
template <class BaseClass>
class WithGenericMethod_GetNetworkState : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
public:
WithGenericMethod_GetNetworkState() {
::grpc::Service::MarkMethodGeneric(36);
}
~WithGenericMethod_GetNetworkState() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
::grpc::Status GetNetworkState(::grpc::ServerContext* /*context*/, const ::tari::rpc::GetNetworkStateRequest* /*request*/, ::tari::rpc::GetNetworkStateResponse* /*response*/) override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
};
template <class BaseClass>
class WithRawMethod_ListHeaders : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
@@ -4069,6 +4157,26 @@ class BaseNode final {
}
};
template <class BaseClass>
class WithRawMethod_GetNetworkState : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
public:
WithRawMethod_GetNetworkState() {
::grpc::Service::MarkMethodRaw(36);
}
~WithRawMethod_GetNetworkState() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
::grpc::Status GetNetworkState(::grpc::ServerContext* /*context*/, const ::tari::rpc::GetNetworkStateRequest* /*request*/, ::tari::rpc::GetNetworkStateResponse* /*response*/) override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
void RequestGetNetworkState(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
::grpc::Service::RequestAsyncUnary(36, context, request, response, new_call_cq, notification_cq, tag);
}
};
template <class BaseClass>
class WithRawCallbackMethod_ListHeaders : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
@@ -4861,6 +4969,28 @@ class BaseNode final {
::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/) { return nullptr; }
};
template <class BaseClass>
class WithRawCallbackMethod_GetNetworkState : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
public:
WithRawCallbackMethod_GetNetworkState() {
::grpc::Service::MarkMethodRawCallback(36,
new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>(
[this](
::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->GetNetworkState(context, request, response); }));
}
~WithRawCallbackMethod_GetNetworkState() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
::grpc::Status GetNetworkState(::grpc::ServerContext* /*context*/, const ::tari::rpc::GetNetworkStateRequest* /*request*/, ::tari::rpc::GetNetworkStateResponse* /*response*/) override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
virtual ::grpc::ServerUnaryReactor* GetNetworkState(
::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; }
};
template <class BaseClass>
class WithStreamedUnaryMethod_GetHeaderByHash : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
@@ -5508,7 +5638,34 @@ class BaseNode final {
// replace default version of method with streamed unary
virtual ::grpc::Status StreamedGetShardKey(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::tari::rpc::GetShardKeyRequest,::tari::rpc::GetShardKeyResponse>* server_unary_streamer) = 0;
};
typedef WithStreamedUnaryMethod_GetHeaderByHash<WithStreamedUnaryMethod_GetBlockTiming<WithStreamedUnaryMethod_GetConstants<WithStreamedUnaryMethod_GetBlockSize<WithStreamedUnaryMethod_GetBlockFees<WithStreamedUnaryMethod_GetVersion<WithStreamedUnaryMethod_CheckForUpdates<WithStreamedUnaryMethod_GetNewBlockTemplate<WithStreamedUnaryMethod_GetNewBlock<WithStreamedUnaryMethod_GetNewBlockWithCoinbases<WithStreamedUnaryMethod_GetNewBlockTemplateWithCoinbases<WithStreamedUnaryMethod_GetNewBlockBlob<WithStreamedUnaryMethod_SubmitBlock<WithStreamedUnaryMethod_SubmitBlockBlob<WithStreamedUnaryMethod_SubmitTransaction<WithStreamedUnaryMethod_GetSyncInfo<WithStreamedUnaryMethod_GetSyncProgress<WithStreamedUnaryMethod_GetTipInfo<WithStreamedUnaryMethod_TransactionState<WithStreamedUnaryMethod_Identify<WithStreamedUnaryMethod_GetNetworkStatus<WithStreamedUnaryMethod_ListConnectedPeers<WithStreamedUnaryMethod_GetMempoolStats<WithStreamedUnaryMethod_GetShardKey<Service > > > > > > > > > > > > > > > > > > > > > > > > StreamedUnaryService;
template <class BaseClass>
class WithStreamedUnaryMethod_GetNetworkState : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
public:
WithStreamedUnaryMethod_GetNetworkState() {
::grpc::Service::MarkMethodStreamed(36,
new ::grpc::internal::StreamedUnaryHandler<
::tari::rpc::GetNetworkStateRequest, ::tari::rpc::GetNetworkStateResponse>(
[this](::grpc::ServerContext* context,
::grpc::ServerUnaryStreamer<
::tari::rpc::GetNetworkStateRequest, ::tari::rpc::GetNetworkStateResponse>* streamer) {
return this->StreamedGetNetworkState(context,
streamer);
}));
}
~WithStreamedUnaryMethod_GetNetworkState() override {
BaseClassMustBeDerivedFromService(this);
}
// disable regular version of this method
::grpc::Status GetNetworkState(::grpc::ServerContext* /*context*/, const ::tari::rpc::GetNetworkStateRequest* /*request*/, ::tari::rpc::GetNetworkStateResponse* /*response*/) override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
// replace default version of method with streamed unary
virtual ::grpc::Status StreamedGetNetworkState(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::tari::rpc::GetNetworkStateRequest,::tari::rpc::GetNetworkStateResponse>* server_unary_streamer) = 0;
};
typedef WithStreamedUnaryMethod_GetHeaderByHash<WithStreamedUnaryMethod_GetBlockTiming<WithStreamedUnaryMethod_GetConstants<WithStreamedUnaryMethod_GetBlockSize<WithStreamedUnaryMethod_GetBlockFees<WithStreamedUnaryMethod_GetVersion<WithStreamedUnaryMethod_CheckForUpdates<WithStreamedUnaryMethod_GetNewBlockTemplate<WithStreamedUnaryMethod_GetNewBlock<WithStreamedUnaryMethod_GetNewBlockWithCoinbases<WithStreamedUnaryMethod_GetNewBlockTemplateWithCoinbases<WithStreamedUnaryMethod_GetNewBlockBlob<WithStreamedUnaryMethod_SubmitBlock<WithStreamedUnaryMethod_SubmitBlockBlob<WithStreamedUnaryMethod_SubmitTransaction<WithStreamedUnaryMethod_GetSyncInfo<WithStreamedUnaryMethod_GetSyncProgress<WithStreamedUnaryMethod_GetTipInfo<WithStreamedUnaryMethod_TransactionState<WithStreamedUnaryMethod_Identify<WithStreamedUnaryMethod_GetNetworkStatus<WithStreamedUnaryMethod_ListConnectedPeers<WithStreamedUnaryMethod_GetMempoolStats<WithStreamedUnaryMethod_GetShardKey<WithStreamedUnaryMethod_GetNetworkState<Service > > > > > > > > > > > > > > > > > > > > > > > > > StreamedUnaryService;
template <class BaseClass>
class WithSplitStreamingMethod_ListHeaders : public BaseClass {
private:
@@ -5834,7 +5991,7 @@ class BaseNode final {
virtual ::grpc::Status StreamedGetSideChainUtxos(::grpc::ServerContext* context, ::grpc::ServerSplitStreamer< ::tari::rpc::GetSideChainUtxosRequest,::tari::rpc::GetSideChainUtxosResponse>* server_split_streamer) = 0;
};
typedef WithSplitStreamingMethod_ListHeaders<WithSplitStreamingMethod_GetBlocks<WithSplitStreamingMethod_GetTokensInCirculation<WithSplitStreamingMethod_GetNetworkDifficulty<WithSplitStreamingMethod_SearchKernels<WithSplitStreamingMethod_SearchUtxos<WithSplitStreamingMethod_FetchMatchingUtxos<WithSplitStreamingMethod_GetPeers<WithSplitStreamingMethod_GetMempoolTransactions<WithSplitStreamingMethod_GetActiveValidatorNodes<WithSplitStreamingMethod_GetTemplateRegistrations<WithSplitStreamingMethod_GetSideChainUtxos<Service > > > > > > > > > > > > SplitStreamedService;
typedef WithSplitStreamingMethod_ListHeaders<WithStreamedUnaryMethod_GetHeaderByHash<WithSplitStreamingMethod_GetBlocks<WithStreamedUnaryMethod_GetBlockTiming<WithStreamedUnaryMethod_GetConstants<WithStreamedUnaryMethod_GetBlockSize<WithStreamedUnaryMethod_GetBlockFees<WithStreamedUnaryMethod_GetVersion<WithStreamedUnaryMethod_CheckForUpdates<WithSplitStreamingMethod_GetTokensInCirculation<WithSplitStreamingMethod_GetNetworkDifficulty<WithStreamedUnaryMethod_GetNewBlockTemplate<WithStreamedUnaryMethod_GetNewBlock<WithStreamedUnaryMethod_GetNewBlockWithCoinbases<WithStreamedUnaryMethod_GetNewBlockTemplateWithCoinbases<WithStreamedUnaryMethod_GetNewBlockBlob<WithStreamedUnaryMethod_SubmitBlock<WithStreamedUnaryMethod_SubmitBlockBlob<WithStreamedUnaryMethod_SubmitTransaction<WithStreamedUnaryMethod_GetSyncInfo<WithStreamedUnaryMethod_GetSyncProgress<WithStreamedUnaryMethod_GetTipInfo<WithSplitStreamingMethod_SearchKernels<WithSplitStreamingMethod_SearchUtxos<WithSplitStreamingMethod_FetchMatchingUtxos<WithSplitStreamingMethod_GetPeers<WithSplitStreamingMethod_GetMempoolTransactions<WithStreamedUnaryMethod_TransactionState<WithStreamedUnaryMethod_Identify<WithStreamedUnaryMethod_GetNetworkStatus<WithStreamedUnaryMethod_ListConnectedPeers<WithStreamedUnaryMethod_GetMempoolStats<WithSplitStreamingMethod_GetActiveValidatorNodes<WithStreamedUnaryMethod_GetShardKey<WithSplitStreamingMethod_GetTemplateRegistrations<WithSplitStreamingMethod_GetSideChainUtxos<Service > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > StreamedService;
typedef WithSplitStreamingMethod_ListHeaders<WithStreamedUnaryMethod_GetHeaderByHash<WithSplitStreamingMethod_GetBlocks<WithStreamedUnaryMethod_GetBlockTiming<WithStreamedUnaryMethod_GetConstants<WithStreamedUnaryMethod_GetBlockSize<WithStreamedUnaryMethod_GetBlockFees<WithStreamedUnaryMethod_GetVersion<WithStreamedUnaryMethod_CheckForUpdates<WithSplitStreamingMethod_GetTokensInCirculation<WithSplitStreamingMethod_GetNetworkDifficulty<WithStreamedUnaryMethod_GetNewBlockTemplate<WithStreamedUnaryMethod_GetNewBlock<WithStreamedUnaryMethod_GetNewBlockWithCoinbases<WithStreamedUnaryMethod_GetNewBlockTemplateWithCoinbases<WithStreamedUnaryMethod_GetNewBlockBlob<WithStreamedUnaryMethod_SubmitBlock<WithStreamedUnaryMethod_SubmitBlockBlob<WithStreamedUnaryMethod_SubmitTransaction<WithStreamedUnaryMethod_GetSyncInfo<WithStreamedUnaryMethod_GetSyncProgress<WithStreamedUnaryMethod_GetTipInfo<WithSplitStreamingMethod_SearchKernels<WithSplitStreamingMethod_SearchUtxos<WithSplitStreamingMethod_FetchMatchingUtxos<WithSplitStreamingMethod_GetPeers<WithSplitStreamingMethod_GetMempoolTransactions<WithStreamedUnaryMethod_TransactionState<WithStreamedUnaryMethod_Identify<WithStreamedUnaryMethod_GetNetworkStatus<WithStreamedUnaryMethod_ListConnectedPeers<WithStreamedUnaryMethod_GetMempoolStats<WithSplitStreamingMethod_GetActiveValidatorNodes<WithStreamedUnaryMethod_GetShardKey<WithSplitStreamingMethod_GetTemplateRegistrations<WithSplitStreamingMethod_GetSideChainUtxos<WithStreamedUnaryMethod_GetNetworkState<Service > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > StreamedService;
};
} // namespace rpc
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+49 -5
View File
@@ -99,6 +99,7 @@ service BaseNode {
// Get templates
rpc GetTemplateRegistrations(GetTemplateRegistrationsRequest) returns (stream GetTemplateRegistrationResponse);
rpc GetSideChainUtxos(GetSideChainUtxosRequest) returns (stream GetSideChainUtxosResponse);
rpc GetNetworkState(GetNetworkStateRequest) returns (GetNetworkStateResponse);
}
message GetAssetMetadataRequest {
@@ -160,6 +161,7 @@ message TipInfoResponse {
MetaData metadata = 1;
bool initial_sync_achieved = 2;
BaseNodeState base_node_state = 3;
bool failed_checkpoints = 4;
}
enum BaseNodeState{
@@ -216,13 +218,17 @@ message NetworkDifficultyResponse {
uint64 timestamp = 4;
uint64 pow_algo = 5;
uint64 sha3x_estimated_hash_rate = 6;
uint64 randomx_estimated_hash_rate = 7;
uint64 monero_randomx_estimated_hash_rate = 7;
uint64 tari_randomx_estimated_hash_rate = 10;
uint64 num_coinbases = 8;
repeated bytes coinbase_extras = 9;
}
// A generic single value response for a specific height
message ValueAtHeightResponse {
uint64 value= 1;
uint64 height = 2;
uint64 circulating_supply = 1;
uint64 spendable_supply = 2;
uint64 height = 3;
}
// A generic uint value
@@ -339,10 +345,11 @@ message MetaData {
uint64 best_block_height = 1;
// The block hash of the current tip of the longest valid chain, or `None` for an empty chain
bytes best_block_hash = 2;
// This is the min height this node can provide complete blocks for. A 0 here means this node is archival and can provide complete blocks for every height.
uint64 pruned_height = 6;
// The current geometric mean of the pow of the chain tip, or `None` if there is no chain
bytes accumulated_difficulty = 5;
// This is the min height this node can provide complete blocks for. A 0 here means this node is archival and can provide complete blocks for every height.
uint64 pruned_height = 6;
uint64 timestamp = 7;
}
message SyncInfoResponse {
@@ -355,6 +362,8 @@ message SyncProgressResponse {
uint64 tip_height = 1;
uint64 local_height = 2;
SyncState state = 3;
string short_desc = 4;
uint64 initial_connected_peers = 5;
}
enum SyncState {
@@ -375,6 +384,7 @@ message GetNewBlockResult{
bytes merge_mining_hash =3;
bytes tari_unique_id =4;
MinerData miner_data = 5;
bytes vm_key = 6;
}
// This is the message that is returned for a miner after it asks for a new block.
@@ -515,3 +525,37 @@ message GetSideChainUtxosResponse {
repeated TransactionOutput outputs = 2;
}
message GetNetworkStateRequest {
}
message GetNetworkStateResponse {
// metadata
MetaData metadata = 1;
// has the base node synced
bool initial_sync_achieved = 2;
//current state of the base node
BaseNodeState base_node_state = 3;
// do we have failed checkpoints
bool failed_checkpoints = 4;
// The block reward of the next tip
uint64 reward = 5;
// estimate sha3x hash rate
uint64 sha3x_estimated_hash_rate = 6;
// estimate randomx hash rate
uint64 monero_randomx_estimated_hash_rate = 7;
uint64 tari_randomx_estimated_hash_rate = 10;
// number of connections
uint64 num_connections = 8;
//liveness results
repeated LivenessResult liveness_results = 9;
}
message LivenessResult{
// node id
bytes peer_node_id = 1;
// time to discover
uint64 discover_latency = 2;
// Dial latency
uint64 ping_latency = 3;
}
+110 -50
View File
@@ -107,6 +107,9 @@ inline constexpr BlockHeader::Impl_::Impl_(
output_mr_(
&::google::protobuf::internal::fixed_address_empty_string,
::_pbi::ConstantInitialized()),
block_output_mr_(
&::google::protobuf::internal::fixed_address_empty_string,
::_pbi::ConstantInitialized()),
kernel_mr_(
&::google::protobuf::internal::fixed_address_empty_string,
::_pbi::ConstantInitialized()),
@@ -149,7 +152,8 @@ inline constexpr NewBlockTemplate::Impl_::Impl_(
::_pbi::ConstantInitialized) noexcept
: _cached_size_{0},
header_{nullptr},
body_{nullptr} {}
body_{nullptr},
is_mempool_in_sync_{false} {}
template <typename>
PROTOBUF_CONSTEXPR NewBlockTemplate::NewBlockTemplate(::_pbi::ConstantInitialized)
@@ -227,6 +231,7 @@ const ::uint32_t
PROTOBUF_FIELD_OFFSET(::tari::rpc::BlockHeader, _impl_.prev_hash_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::BlockHeader, _impl_.timestamp_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::BlockHeader, _impl_.output_mr_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::BlockHeader, _impl_.block_output_mr_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::BlockHeader, _impl_.kernel_mr_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::BlockHeader, _impl_.input_mr_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::BlockHeader, _impl_.total_kernel_offset_),
@@ -247,6 +252,7 @@ const ::uint32_t
~0u,
~0u,
~0u,
~0u,
0,
~0u,
~0u,
@@ -326,19 +332,21 @@ const ::uint32_t
~0u, // no sizeof(Split)
PROTOBUF_FIELD_OFFSET(::tari::rpc::NewBlockTemplate, _impl_.header_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::NewBlockTemplate, _impl_.body_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::NewBlockTemplate, _impl_.is_mempool_in_sync_),
0,
1,
~0u,
};
static const ::_pbi::MigrationSchema
schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
{0, 24, -1, sizeof(::tari::rpc::BlockHeader)},
{40, -1, -1, sizeof(::tari::rpc::ProofOfWork)},
{50, -1, -1, sizeof(::tari::rpc::PowAlgo)},
{59, 69, -1, sizeof(::tari::rpc::Block)},
{71, 81, -1, sizeof(::tari::rpc::HistoricalBlock)},
{83, 97, -1, sizeof(::tari::rpc::NewBlockHeaderTemplate)},
{103, 113, -1, sizeof(::tari::rpc::NewBlockTemplate)},
{0, 25, -1, sizeof(::tari::rpc::BlockHeader)},
{42, -1, -1, sizeof(::tari::rpc::ProofOfWork)},
{52, -1, -1, sizeof(::tari::rpc::PowAlgo)},
{61, 71, -1, sizeof(::tari::rpc::Block)},
{73, 83, -1, sizeof(::tari::rpc::HistoricalBlock)},
{85, 99, -1, sizeof(::tari::rpc::NewBlockHeaderTemplate)},
{105, 116, -1, sizeof(::tari::rpc::NewBlockTemplate)},
};
static const ::_pb::Message* const file_default_instances[] = {
&::tari::rpc::_BlockHeader_default_instance_._instance,
@@ -352,31 +360,33 @@ static const ::_pb::Message* const file_default_instances[] = {
const char descriptor_table_protodef_block_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE(
protodesc_cold) = {
"\n\013block.proto\022\010tari.rpc\032\021transaction.pro"
"to\"\361\002\n\013BlockHeader\022\014\n\004hash\030\001 \001(\014\022\017\n\007vers"
"to\"\212\003\n\013BlockHeader\022\014\n\004hash\030\001 \001(\014\022\017\n\007vers"
"ion\030\002 \001(\r\022\016\n\006height\030\003 \001(\004\022\021\n\tprev_hash\030\004"
" \001(\014\022\021\n\ttimestamp\030\005 \001(\004\022\021\n\toutput_mr\030\006 \001"
"(\014\022\021\n\tkernel_mr\030\010 \001(\014\022\020\n\010input_mr\030\t \001(\014\022"
"\033\n\023total_kernel_offset\030\n \001(\014\022\r\n\005nonce\030\013 "
"\001(\004\022\"\n\003pow\030\014 \001(\0132\025.tari.rpc.ProofOfWork\022"
"\027\n\017kernel_mmr_size\030\r \001(\004\022\027\n\017output_mmr_s"
"ize\030\016 \001(\004\022\033\n\023total_script_offset\030\017 \001(\014\022\031"
"\n\021validator_node_mr\030\020 \001(\014\022\033\n\023validator_n"
"ode_size\030\021 \001(\004\"1\n\013ProofOfWork\022\020\n\010pow_alg"
"o\030\001 \001(\004\022\020\n\010pow_data\030\004 \001(\014\"o\n\007PowAlgo\022,\n\010"
"pow_algo\030\001 \001(\0162\032.tari.rpc.PowAlgo.PowAlg"
"os\"6\n\010PowAlgos\022\025\n\021POW_ALGOS_RANDOMX\020\000\022\023\n"
"\017POW_ALGOS_SHA3X\020\001\"U\n\005Block\022%\n\006header\030\001 "
"\001(\0132\025.tari.rpc.BlockHeader\022%\n\004body\030\002 \001(\013"
"2\027.tari.rpc.AggregateBody\"H\n\017HistoricalB"
"lock\022\025\n\rconfirmations\030\001 \001(\004\022\036\n\005block\030\002 \001"
"(\0132\017.tari.rpc.Block\"\252\001\n\026NewBlockHeaderTe"
"mplate\022\017\n\007version\030\001 \001(\r\022\016\n\006height\030\002 \001(\004\022"
"\021\n\tprev_hash\030\003 \001(\014\022\033\n\023total_kernel_offse"
"t\030\004 \001(\014\022\"\n\003pow\030\005 \001(\0132\025.tari.rpc.ProofOfW"
"ork\022\033\n\023total_script_offset\030\007 \001(\014\"k\n\020NewB"
"lockTemplate\0220\n\006header\030\001 \001(\0132 .tari.rpc."
"NewBlockHeaderTemplate\022%\n\004body\030\002 \001(\0132\027.t"
"ari.rpc.AggregateBodyb\006proto3"
"(\014\022\027\n\017block_output_mr\030\007 \001(\014\022\021\n\tkernel_mr"
"\030\010 \001(\014\022\020\n\010input_mr\030\t \001(\014\022\033\n\023total_kernel"
"_offset\030\n \001(\014\022\r\n\005nonce\030\013 \001(\004\022\"\n\003pow\030\014 \001("
"\0132\025.tari.rpc.ProofOfWork\022\027\n\017kernel_mmr_s"
"ize\030\r \001(\004\022\027\n\017output_mmr_size\030\016 \001(\004\022\033\n\023to"
"tal_script_offset\030\017 \001(\014\022\031\n\021validator_nod"
"e_mr\030\020 \001(\014\022\033\n\023validator_node_size\030\021 \001(\004\""
"1\n\013ProofOfWork\022\020\n\010pow_algo\030\001 \001(\004\022\020\n\010pow_"
"data\030\004 \001(\014\"\210\001\n\007PowAlgo\022,\n\010pow_algo\030\001 \001(\016"
"2\032.tari.rpc.PowAlgo.PowAlgos\"O\n\010PowAlgos"
"\022\026\n\022POW_ALGOS_RANDOMXM\020\000\022\023\n\017POW_ALGOS_SH"
"A3X\020\001\022\026\n\022POW_ALGOS_RANDOMXT\020\002\"U\n\005Block\022%"
"\n\006header\030\001 \001(\0132\025.tari.rpc.BlockHeader\022%\n"
"\004body\030\002 \001(\0132\027.tari.rpc.AggregateBody\"H\n\017"
"HistoricalBlock\022\025\n\rconfirmations\030\001 \001(\004\022\036"
"\n\005block\030\002 \001(\0132\017.tari.rpc.Block\"\252\001\n\026NewBl"
"ockHeaderTemplate\022\017\n\007version\030\001 \001(\r\022\016\n\006he"
"ight\030\002 \001(\004\022\021\n\tprev_hash\030\003 \001(\014\022\033\n\023total_k"
"ernel_offset\030\004 \001(\014\022\"\n\003pow\030\005 \001(\0132\025.tari.r"
"pc.ProofOfWork\022\033\n\023total_script_offset\030\007 "
"\001(\014\"\207\001\n\020NewBlockTemplate\0220\n\006header\030\001 \001(\013"
"2 .tari.rpc.NewBlockHeaderTemplate\022%\n\004bo"
"dy\030\002 \001(\0132\027.tari.rpc.AggregateBody\022\032\n\022is_"
"mempool_in_sync\030\003 \001(\010b\006proto3"
};
static const ::_pbi::DescriptorTable* const descriptor_table_block_2eproto_deps[1] =
{
@@ -386,7 +396,7 @@ static ::absl::once_flag descriptor_table_block_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_block_2eproto = {
false,
false,
1029,
1109,
descriptor_table_protodef_block_2eproto,
"block.proto",
&descriptor_table_block_2eproto_once,
@@ -422,15 +432,16 @@ const ::google::protobuf::EnumDescriptor* PowAlgo_PowAlgos_descriptor() {
return file_level_enum_descriptors_block_2eproto[0];
}
PROTOBUF_CONSTINIT const uint32_t PowAlgo_PowAlgos_internal_data_[] = {
131072u, 0u, };
196608u, 0u, };
bool PowAlgo_PowAlgos_IsValid(int value) {
return 0 <= value && value <= 1;
return 0 <= value && value <= 2;
}
#if (__cplusplus < 201703) && \
(!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
constexpr PowAlgo_PowAlgos PowAlgo::POW_ALGOS_RANDOMX;
constexpr PowAlgo_PowAlgos PowAlgo::POW_ALGOS_RANDOMXM;
constexpr PowAlgo_PowAlgos PowAlgo::POW_ALGOS_SHA3X;
constexpr PowAlgo_PowAlgos PowAlgo::POW_ALGOS_RANDOMXT;
constexpr PowAlgo_PowAlgos PowAlgo::PowAlgos_MIN;
constexpr PowAlgo_PowAlgos PowAlgo::PowAlgos_MAX;
constexpr int PowAlgo::PowAlgos_ARRAYSIZE;
@@ -459,6 +470,7 @@ inline PROTOBUF_NDEBUG_INLINE BlockHeader::Impl_::Impl_(
hash_(arena, from.hash_),
prev_hash_(arena, from.prev_hash_),
output_mr_(arena, from.output_mr_),
block_output_mr_(arena, from.block_output_mr_),
kernel_mr_(arena, from.kernel_mr_),
input_mr_(arena, from.input_mr_),
total_kernel_offset_(arena, from.total_kernel_offset_),
@@ -495,6 +507,7 @@ inline PROTOBUF_NDEBUG_INLINE BlockHeader::Impl_::Impl_(
hash_(arena),
prev_hash_(arena),
output_mr_(arena),
block_output_mr_(arena),
kernel_mr_(arena),
input_mr_(arena),
total_kernel_offset_(arena),
@@ -520,6 +533,7 @@ inline void BlockHeader::SharedDtor() {
_impl_.hash_.Destroy();
_impl_.prev_hash_.Destroy();
_impl_.output_mr_.Destroy();
_impl_.block_output_mr_.Destroy();
_impl_.kernel_mr_.Destroy();
_impl_.input_mr_.Destroy();
_impl_.total_kernel_offset_.Destroy();
@@ -553,6 +567,7 @@ PROTOBUF_NOINLINE void BlockHeader::Clear() {
_impl_.hash_.ClearToEmpty();
_impl_.prev_hash_.ClearToEmpty();
_impl_.output_mr_.ClearToEmpty();
_impl_.block_output_mr_.ClearToEmpty();
_impl_.kernel_mr_.ClearToEmpty();
_impl_.input_mr_.ClearToEmpty();
_impl_.total_kernel_offset_.ClearToEmpty();
@@ -578,15 +593,15 @@ const char* BlockHeader::_InternalParse(
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
const ::_pbi::TcParseTable<5, 16, 1, 0, 2> BlockHeader::_table_ = {
const ::_pbi::TcParseTable<5, 17, 1, 0, 2> BlockHeader::_table_ = {
{
PROTOBUF_FIELD_OFFSET(BlockHeader, _impl_._has_bits_),
0, // no _extensions_
17, 248, // max_field_number, fast_idx_mask
offsetof(decltype(_table_), field_lookup_table),
4294836288, // skipmap
4294836224, // skipmap
offsetof(decltype(_table_), field_entries),
16, // num_field_entries
17, // num_field_entries
1, // num_aux_entries
offsetof(decltype(_table_), aux_entries),
&_BlockHeader_default_instance_._instance,
@@ -614,7 +629,9 @@ const ::_pbi::TcParseTable<5, 16, 1, 0, 2> BlockHeader::_table_ = {
// bytes output_mr = 6;
{::_pbi::TcParser::FastBS1,
{50, 63, 0, PROTOBUF_FIELD_OFFSET(BlockHeader, _impl_.output_mr_)}},
{::_pbi::TcParser::MiniParse, {}},
// bytes block_output_mr = 7;
{::_pbi::TcParser::FastBS1,
{58, 63, 0, PROTOBUF_FIELD_OFFSET(BlockHeader, _impl_.block_output_mr_)}},
// bytes kernel_mr = 8;
{::_pbi::TcParser::FastBS1,
{66, 63, 0, PROTOBUF_FIELD_OFFSET(BlockHeader, _impl_.kernel_mr_)}},
@@ -680,6 +697,9 @@ const ::_pbi::TcParseTable<5, 16, 1, 0, 2> BlockHeader::_table_ = {
// bytes output_mr = 6;
{PROTOBUF_FIELD_OFFSET(BlockHeader, _impl_.output_mr_), -1, 0,
(0 | ::_fl::kFcSingular | ::_fl::kBytes | ::_fl::kRepAString)},
// bytes block_output_mr = 7;
{PROTOBUF_FIELD_OFFSET(BlockHeader, _impl_.block_output_mr_), -1, 0,
(0 | ::_fl::kFcSingular | ::_fl::kBytes | ::_fl::kRepAString)},
// bytes kernel_mr = 8;
{PROTOBUF_FIELD_OFFSET(BlockHeader, _impl_.kernel_mr_), -1, 0,
(0 | ::_fl::kFcSingular | ::_fl::kBytes | ::_fl::kRepAString)},
@@ -762,6 +782,12 @@ const ::_pbi::TcParseTable<5, 16, 1, 0, 2> BlockHeader::_table_ = {
target = stream->WriteBytesMaybeAliased(6, _s, target);
}
// bytes block_output_mr = 7;
if (!this->_internal_block_output_mr().empty()) {
const std::string& _s = this->_internal_block_output_mr();
target = stream->WriteBytesMaybeAliased(7, _s, target);
}
// bytes kernel_mr = 8;
if (!this->_internal_kernel_mr().empty()) {
const std::string& _s = this->_internal_kernel_mr();
@@ -862,6 +888,12 @@ const ::_pbi::TcParseTable<5, 16, 1, 0, 2> BlockHeader::_table_ = {
this->_internal_output_mr());
}
// bytes block_output_mr = 7;
if (!this->_internal_block_output_mr().empty()) {
total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize(
this->_internal_block_output_mr());
}
// bytes kernel_mr = 8;
if (!this->_internal_kernel_mr().empty()) {
total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize(
@@ -963,6 +995,9 @@ void BlockHeader::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goo
if (!from._internal_output_mr().empty()) {
_this->_internal_set_output_mr(from._internal_output_mr());
}
if (!from._internal_block_output_mr().empty()) {
_this->_internal_set_block_output_mr(from._internal_block_output_mr());
}
if (!from._internal_kernel_mr().empty()) {
_this->_internal_set_kernel_mr(from._internal_kernel_mr());
}
@@ -1033,6 +1068,7 @@ void BlockHeader::InternalSwap(BlockHeader* PROTOBUF_RESTRICT other) {
::_pbi::ArenaStringPtr::InternalSwap(&_impl_.hash_, &other->_impl_.hash_, arena);
::_pbi::ArenaStringPtr::InternalSwap(&_impl_.prev_hash_, &other->_impl_.prev_hash_, arena);
::_pbi::ArenaStringPtr::InternalSwap(&_impl_.output_mr_, &other->_impl_.output_mr_, arena);
::_pbi::ArenaStringPtr::InternalSwap(&_impl_.block_output_mr_, &other->_impl_.block_output_mr_, arena);
::_pbi::ArenaStringPtr::InternalSwap(&_impl_.kernel_mr_, &other->_impl_.kernel_mr_, arena);
::_pbi::ArenaStringPtr::InternalSwap(&_impl_.input_mr_, &other->_impl_.input_mr_, arena);
::_pbi::ArenaStringPtr::InternalSwap(&_impl_.total_kernel_offset_, &other->_impl_.total_kernel_offset_, arena);
@@ -2366,6 +2402,7 @@ NewBlockTemplate::NewBlockTemplate(
_impl_.body_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::tari::rpc::AggregateBody>(
arena, *from._impl_.body_)
: nullptr;
_impl_.is_mempool_in_sync_ = from._impl_.is_mempool_in_sync_;
// @@protoc_insertion_point(copy_constructor:tari.rpc.NewBlockTemplate)
}
@@ -2379,9 +2416,9 @@ inline void NewBlockTemplate::SharedCtor(::_pb::Arena* arena) {
::memset(reinterpret_cast<char *>(&_impl_) +
offsetof(Impl_, header_),
0,
offsetof(Impl_, body_) -
offsetof(Impl_, is_mempool_in_sync_) -
offsetof(Impl_, header_) +
sizeof(Impl_::body_));
sizeof(Impl_::is_mempool_in_sync_));
}
NewBlockTemplate::~NewBlockTemplate() {
// @@protoc_insertion_point(destructor:tari.rpc.NewBlockTemplate)
@@ -2427,6 +2464,7 @@ PROTOBUF_NOINLINE void NewBlockTemplate::Clear() {
_impl_.body_->Clear();
}
}
_impl_.is_mempool_in_sync_ = false;
_impl_._has_bits_.Clear();
_internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>();
}
@@ -2439,15 +2477,15 @@ const char* NewBlockTemplate::_InternalParse(
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
const ::_pbi::TcParseTable<1, 2, 2, 0, 2> NewBlockTemplate::_table_ = {
const ::_pbi::TcParseTable<2, 3, 2, 0, 2> NewBlockTemplate::_table_ = {
{
PROTOBUF_FIELD_OFFSET(NewBlockTemplate, _impl_._has_bits_),
0, // no _extensions_
2, 8, // max_field_number, fast_idx_mask
3, 24, // max_field_number, fast_idx_mask
offsetof(decltype(_table_), field_lookup_table),
4294967292, // skipmap
4294967288, // skipmap
offsetof(decltype(_table_), field_entries),
2, // num_field_entries
3, // num_field_entries
2, // num_aux_entries
offsetof(decltype(_table_), aux_entries),
&_NewBlockTemplate_default_instance_._instance,
@@ -2456,12 +2494,16 @@ const ::_pbi::TcParseTable<1, 2, 2, 0, 2> NewBlockTemplate::_table_ = {
::_pbi::TcParser::GetTable<::tari::rpc::NewBlockTemplate>(), // to_prefetch
#endif // PROTOBUF_PREFETCH_PARSE_TABLE
}, {{
// .tari.rpc.AggregateBody body = 2;
{::_pbi::TcParser::FastMtS1,
{18, 1, 1, PROTOBUF_FIELD_OFFSET(NewBlockTemplate, _impl_.body_)}},
{::_pbi::TcParser::MiniParse, {}},
// .tari.rpc.NewBlockHeaderTemplate header = 1;
{::_pbi::TcParser::FastMtS1,
{10, 0, 0, PROTOBUF_FIELD_OFFSET(NewBlockTemplate, _impl_.header_)}},
// .tari.rpc.AggregateBody body = 2;
{::_pbi::TcParser::FastMtS1,
{18, 1, 1, PROTOBUF_FIELD_OFFSET(NewBlockTemplate, _impl_.body_)}},
// bool is_mempool_in_sync = 3;
{::_pbi::TcParser::SingularVarintNoZag1<bool, offsetof(NewBlockTemplate, _impl_.is_mempool_in_sync_), 63>(),
{24, 63, 0, PROTOBUF_FIELD_OFFSET(NewBlockTemplate, _impl_.is_mempool_in_sync_)}},
}}, {{
65535, 65535
}}, {{
@@ -2471,6 +2513,9 @@ const ::_pbi::TcParseTable<1, 2, 2, 0, 2> NewBlockTemplate::_table_ = {
// .tari.rpc.AggregateBody body = 2;
{PROTOBUF_FIELD_OFFSET(NewBlockTemplate, _impl_.body_), _Internal::kHasBitsOffset + 1, 1,
(0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)},
// bool is_mempool_in_sync = 3;
{PROTOBUF_FIELD_OFFSET(NewBlockTemplate, _impl_.is_mempool_in_sync_), -1, 0,
(0 | ::_fl::kFcSingular | ::_fl::kBool)},
}}, {{
{::_pbi::TcParser::GetTable<::tari::rpc::NewBlockHeaderTemplate>()},
{::_pbi::TcParser::GetTable<::tari::rpc::AggregateBody>()},
@@ -2498,6 +2543,13 @@ const ::_pbi::TcParseTable<1, 2, 2, 0, 2> NewBlockTemplate::_table_ = {
2, *_impl_.body_, _impl_.body_->GetCachedSize(), target, stream);
}
// bool is_mempool_in_sync = 3;
if (this->_internal_is_mempool_in_sync() != 0) {
target = stream->EnsureSpace(target);
target = ::_pbi::WireFormatLite::WriteBoolToArray(
3, this->_internal_is_mempool_in_sync(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target =
::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
@@ -2530,6 +2582,11 @@ const ::_pbi::TcParseTable<1, 2, 2, 0, 2> NewBlockTemplate::_table_ = {
}
}
// bool is_mempool_in_sync = 3;
if (this->_internal_is_mempool_in_sync() != 0) {
total_size += 2;
}
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
@@ -2564,6 +2621,9 @@ void NewBlockTemplate::MergeImpl(::google::protobuf::MessageLite& to_msg, const
}
}
}
if (from._internal_is_mempool_in_sync() != 0) {
_this->_impl_.is_mempool_in_sync_ = from._impl_.is_mempool_in_sync_;
}
_this->_impl_._has_bits_[0] |= cached_has_bits;
_this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_);
}
@@ -2584,8 +2644,8 @@ void NewBlockTemplate::InternalSwap(NewBlockTemplate* PROTOBUF_RESTRICT other) {
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
::google::protobuf::internal::memswap<
PROTOBUF_FIELD_OFFSET(NewBlockTemplate, _impl_.body_)
+ sizeof(NewBlockTemplate::_impl_.body_)
PROTOBUF_FIELD_OFFSET(NewBlockTemplate, _impl_.is_mempool_in_sync_)
+ sizeof(NewBlockTemplate::_impl_.is_mempool_in_sync_)
- PROTOBUF_FIELD_OFFSET(NewBlockTemplate, _impl_.header_)>(
reinterpret_cast<char*>(&_impl_.header_),
reinterpret_cast<char*>(&other->_impl_.header_));
+111 -7
View File
@@ -84,8 +84,9 @@ namespace protobuf {
namespace tari {
namespace rpc {
enum PowAlgo_PowAlgos : int {
PowAlgo_PowAlgos_POW_ALGOS_RANDOMX = 0,
PowAlgo_PowAlgos_POW_ALGOS_RANDOMXM = 0,
PowAlgo_PowAlgos_POW_ALGOS_SHA3X = 1,
PowAlgo_PowAlgos_POW_ALGOS_RANDOMXT = 2,
PowAlgo_PowAlgos_PowAlgo_PowAlgos_INT_MIN_SENTINEL_DO_NOT_USE_ =
std::numeric_limits<::int32_t>::min(),
PowAlgo_PowAlgos_PowAlgo_PowAlgos_INT_MAX_SENTINEL_DO_NOT_USE_ =
@@ -95,8 +96,8 @@ enum PowAlgo_PowAlgos : int {
bool PowAlgo_PowAlgos_IsValid(int value);
extern const uint32_t PowAlgo_PowAlgos_internal_data_[];
constexpr PowAlgo_PowAlgos PowAlgo_PowAlgos_PowAlgos_MIN = static_cast<PowAlgo_PowAlgos>(0);
constexpr PowAlgo_PowAlgos PowAlgo_PowAlgos_PowAlgos_MAX = static_cast<PowAlgo_PowAlgos>(1);
constexpr int PowAlgo_PowAlgos_PowAlgos_ARRAYSIZE = 1 + 1;
constexpr PowAlgo_PowAlgos PowAlgo_PowAlgos_PowAlgos_MAX = static_cast<PowAlgo_PowAlgos>(2);
constexpr int PowAlgo_PowAlgos_PowAlgos_ARRAYSIZE = 2 + 1;
const ::google::protobuf::EnumDescriptor*
PowAlgo_PowAlgos_descriptor();
template <typename T>
@@ -109,7 +110,7 @@ const std::string& PowAlgo_PowAlgos_Name(T value) {
template <>
inline const std::string& PowAlgo_PowAlgos_Name(PowAlgo_PowAlgos value) {
return ::google::protobuf::internal::NameOfDenseEnum<PowAlgo_PowAlgos_descriptor,
0, 1>(
0, 2>(
static_cast<int>(value));
}
inline bool PowAlgo_PowAlgos_Parse(absl::string_view name, PowAlgo_PowAlgos* value) {
@@ -430,8 +431,9 @@ class PowAlgo final : public ::google::protobuf::Message
::google::protobuf::Metadata GetMetadata() const final;
// nested types ----------------------------------------------------
using PowAlgos = PowAlgo_PowAlgos;
static constexpr PowAlgos POW_ALGOS_RANDOMX = PowAlgo_PowAlgos_POW_ALGOS_RANDOMX;
static constexpr PowAlgos POW_ALGOS_RANDOMXM = PowAlgo_PowAlgos_POW_ALGOS_RANDOMXM;
static constexpr PowAlgos POW_ALGOS_SHA3X = PowAlgo_PowAlgos_POW_ALGOS_SHA3X;
static constexpr PowAlgos POW_ALGOS_RANDOMXT = PowAlgo_PowAlgos_POW_ALGOS_RANDOMXT;
static inline bool PowAlgos_IsValid(int value) {
return PowAlgo_PowAlgos_IsValid(value);
}
@@ -872,6 +874,7 @@ class BlockHeader final : public ::google::protobuf::Message
kHashFieldNumber = 1,
kPrevHashFieldNumber = 4,
kOutputMrFieldNumber = 6,
kBlockOutputMrFieldNumber = 7,
kKernelMrFieldNumber = 8,
kInputMrFieldNumber = 9,
kTotalKernelOffsetFieldNumber = 10,
@@ -933,6 +936,22 @@ class BlockHeader final : public ::google::protobuf::Message
const std::string& value);
std::string* _internal_mutable_output_mr();
public:
// bytes block_output_mr = 7;
void clear_block_output_mr() ;
const std::string& block_output_mr() const;
template <typename Arg_ = const std::string&, typename... Args_>
void set_block_output_mr(Arg_&& arg, Args_... args);
std::string* mutable_block_output_mr();
PROTOBUF_NODISCARD std::string* release_block_output_mr();
void set_allocated_block_output_mr(std::string* value);
private:
const std::string& _internal_block_output_mr() const;
inline PROTOBUF_ALWAYS_INLINE void _internal_set_block_output_mr(
const std::string& value);
std::string* _internal_mutable_block_output_mr();
public:
// bytes kernel_mr = 8;
void clear_kernel_mr() ;
@@ -1104,7 +1123,7 @@ class BlockHeader final : public ::google::protobuf::Message
class _Internal;
friend class ::google::protobuf::internal::TcParser;
static const ::google::protobuf::internal::TcParseTable<
5, 16, 1,
5, 17, 1,
0, 2>
_table_;
friend class ::google::protobuf::MessageLite;
@@ -1125,6 +1144,7 @@ class BlockHeader final : public ::google::protobuf::Message
::google::protobuf::internal::ArenaStringPtr hash_;
::google::protobuf::internal::ArenaStringPtr prev_hash_;
::google::protobuf::internal::ArenaStringPtr output_mr_;
::google::protobuf::internal::ArenaStringPtr block_output_mr_;
::google::protobuf::internal::ArenaStringPtr kernel_mr_;
::google::protobuf::internal::ArenaStringPtr input_mr_;
::google::protobuf::internal::ArenaStringPtr total_kernel_offset_;
@@ -1272,6 +1292,7 @@ class NewBlockTemplate final : public ::google::protobuf::Message
enum : int {
kHeaderFieldNumber = 1,
kBodyFieldNumber = 2,
kIsMempoolInSyncFieldNumber = 3,
};
// .tari.rpc.NewBlockHeaderTemplate header = 1;
bool has_header() const;
@@ -1302,13 +1323,23 @@ class NewBlockTemplate final : public ::google::protobuf::Message
const ::tari::rpc::AggregateBody& _internal_body() const;
::tari::rpc::AggregateBody* _internal_mutable_body();
public:
// bool is_mempool_in_sync = 3;
void clear_is_mempool_in_sync() ;
bool is_mempool_in_sync() const;
void set_is_mempool_in_sync(bool value);
private:
bool _internal_is_mempool_in_sync() const;
void _internal_set_is_mempool_in_sync(bool value);
public:
// @@protoc_insertion_point(class_scope:tari.rpc.NewBlockTemplate)
private:
class _Internal;
friend class ::google::protobuf::internal::TcParser;
static const ::google::protobuf::internal::TcParseTable<
1, 2, 2,
2, 3, 2,
0, 2>
_table_;
friend class ::google::protobuf::MessageLite;
@@ -1328,6 +1359,7 @@ class NewBlockTemplate final : public ::google::protobuf::Message
mutable ::google::protobuf::internal::CachedSize _cached_size_;
::tari::rpc::NewBlockHeaderTemplate* header_;
::tari::rpc::AggregateBody* body_;
bool is_mempool_in_sync_;
PROTOBUF_TSAN_DECLARE_MEMBER
};
union { Impl_ _impl_; };
@@ -1941,6 +1973,56 @@ inline void BlockHeader::set_allocated_output_mr(std::string* value) {
// @@protoc_insertion_point(field_set_allocated:tari.rpc.BlockHeader.output_mr)
}
// bytes block_output_mr = 7;
inline void BlockHeader::clear_block_output_mr() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_.block_output_mr_.ClearToEmpty();
}
inline const std::string& BlockHeader::block_output_mr() const
ABSL_ATTRIBUTE_LIFETIME_BOUND {
// @@protoc_insertion_point(field_get:tari.rpc.BlockHeader.block_output_mr)
return _internal_block_output_mr();
}
template <typename Arg_, typename... Args_>
inline PROTOBUF_ALWAYS_INLINE void BlockHeader::set_block_output_mr(Arg_&& arg,
Args_... args) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_.block_output_mr_.SetBytes(static_cast<Arg_&&>(arg), args..., GetArena());
// @@protoc_insertion_point(field_set:tari.rpc.BlockHeader.block_output_mr)
}
inline std::string* BlockHeader::mutable_block_output_mr() ABSL_ATTRIBUTE_LIFETIME_BOUND {
std::string* _s = _internal_mutable_block_output_mr();
// @@protoc_insertion_point(field_mutable:tari.rpc.BlockHeader.block_output_mr)
return _s;
}
inline const std::string& BlockHeader::_internal_block_output_mr() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
return _impl_.block_output_mr_.Get();
}
inline void BlockHeader::_internal_set_block_output_mr(const std::string& value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_.block_output_mr_.Set(value, GetArena());
}
inline std::string* BlockHeader::_internal_mutable_block_output_mr() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
return _impl_.block_output_mr_.Mutable( GetArena());
}
inline std::string* BlockHeader::release_block_output_mr() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
// @@protoc_insertion_point(field_release:tari.rpc.BlockHeader.block_output_mr)
return _impl_.block_output_mr_.Release();
}
inline void BlockHeader::set_allocated_block_output_mr(std::string* value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_.block_output_mr_.SetAllocated(value, GetArena());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (_impl_.block_output_mr_.IsDefault()) {
_impl_.block_output_mr_.Set("", GetArena());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:tari.rpc.BlockHeader.block_output_mr)
}
// bytes kernel_mr = 8;
inline void BlockHeader::clear_kernel_mr() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
@@ -3275,6 +3357,28 @@ inline void NewBlockTemplate::set_allocated_body(::tari::rpc::AggregateBody* val
// @@protoc_insertion_point(field_set_allocated:tari.rpc.NewBlockTemplate.body)
}
// bool is_mempool_in_sync = 3;
inline void NewBlockTemplate::clear_is_mempool_in_sync() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_.is_mempool_in_sync_ = false;
}
inline bool NewBlockTemplate::is_mempool_in_sync() const {
// @@protoc_insertion_point(field_get:tari.rpc.NewBlockTemplate.is_mempool_in_sync)
return _internal_is_mempool_in_sync();
}
inline void NewBlockTemplate::set_is_mempool_in_sync(bool value) {
_internal_set_is_mempool_in_sync(value);
// @@protoc_insertion_point(field_set:tari.rpc.NewBlockTemplate.is_mempool_in_sync)
}
inline bool NewBlockTemplate::_internal_is_mempool_in_sync() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
return _impl_.is_mempool_in_sync_;
}
inline void NewBlockTemplate::_internal_set_is_mempool_in_sync(bool value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_.is_mempool_in_sync_ = value;
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__
+8 -3
View File
@@ -38,9 +38,10 @@ message BlockHeader {
bytes prev_hash = 4;
// Timestamp at which the block was built.
uint64 timestamp = 5;
// This is the UTXO merkle root of the outputs
// This is calculated as Hash (txo MMR root || roaring bitmap hash of UTXO indices)
// This is the UTXO merkle root of the outputs in the blockchain
bytes output_mr = 6;
// This is the merkle root of all outputs in this block
bytes block_output_mr = 7;
// This is the MMR root of the kernels
bytes kernel_mr = 8;
// This is the Merkle root of the inputs in this block
@@ -79,8 +80,9 @@ message ProofOfWork {
message PowAlgo {
// The permitted pow algorithms
enum PowAlgos {
POW_ALGOS_RANDOMX = 0; // Accessible as `grpc::pow_algo::PowAlgos::Randomx`
POW_ALGOS_RANDOMXM = 0; // Accessible as `grpc::pow_algo::PowAlgos::RandomxM`
POW_ALGOS_SHA3X = 1; // Accessible as `grpc::pow_algo::PowAlgos::Sha3x`
POW_ALGOS_RANDOMXT = 2; // Accessible as `grpc::pow_algo::PowAlgos::RandomxT`
}
// The pow algo to use
PowAlgos pow_algo = 1;
@@ -133,5 +135,8 @@ message NewBlockTemplate {
// This flag indicates if the inputs, outputs and kernels have been sorted internally, that is, the sort() method
// has been called. This may be false even if all components are sorted.
AggregateBody body = 2;
// Sometimes the mempool has not synced to the latest tip, this flag indicates if the mempool is out of sync.
// In most cases the next call to get_new_block_template will return a block with the mempool in sync.
bool is_mempool_in_sync = 3;
}
+58 -14
View File
@@ -108,6 +108,7 @@ inline constexpr UnblindedOutput::Impl_::Impl_(
::_pbi::ConstantInitialized()),
features_{nullptr},
metadata_signature_{nullptr},
range_proof_{nullptr},
value_{::uint64_t{0u}},
script_lock_height_{::uint64_t{0u}},
minimum_value_promise_{::uint64_t{0u}} {}
@@ -427,6 +428,7 @@ const ::uint32_t
PROTOBUF_FIELD_OFFSET(::tari::rpc::UnblindedOutput, _impl_.covenant_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::UnblindedOutput, _impl_.encrypted_data_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::UnblindedOutput, _impl_.minimum_value_promise_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::UnblindedOutput, _impl_.range_proof_),
~0u,
~0u,
0,
@@ -439,6 +441,7 @@ const ::uint32_t
~0u,
~0u,
~0u,
2,
};
static const ::_pbi::MigrationSchema
@@ -449,7 +452,7 @@ static const ::_pbi::MigrationSchema
{90, 104, -1, sizeof(::tari::rpc::OutputFeatures)},
{110, -1, -1, sizeof(::tari::rpc::AggregateBody)},
{121, 132, -1, sizeof(::tari::rpc::Transaction)},
{135, 155, -1, sizeof(::tari::rpc::UnblindedOutput)},
{135, 156, -1, sizeof(::tari::rpc::UnblindedOutput)},
};
static const ::_pb::Message* const file_default_instances[] = {
&::tari::rpc::_TransactionKernel_default_instance_._instance,
@@ -498,7 +501,7 @@ const char descriptor_table_protodef_transaction_2eproto[] ABSL_ATTRIBUTE_SECTIO
"tari.rpc.TransactionKernel\"[\n\013Transactio"
"n\022\016\n\006offset\030\001 \001(\014\022%\n\004body\030\002 \001(\0132\027.tari.r"
"pc.AggregateBody\022\025\n\rscript_offset\030\003 \001(\014\""
"\343\002\n\017UnblindedOutput\022\r\n\005value\030\001 \001(\004\022\024\n\014sp"
"\216\003\n\017UnblindedOutput\022\r\n\005value\030\001 \001(\004\022\024\n\014sp"
"ending_key\030\002 \001(\014\022*\n\010features\030\003 \001(\0132\030.tar"
"i.rpc.OutputFeatures\022\016\n\006script\030\004 \001(\014\022\022\n\n"
"input_data\030\005 \001(\014\022\032\n\022script_private_key\030\007"
@@ -506,8 +509,9 @@ const char descriptor_table_protodef_transaction_2eproto[] ABSL_ATTRIBUTE_SECTIO
"\n\022metadata_signature\030\t \001(\0132\034.tari.rpc.Co"
"mAndPubSignature\022\032\n\022script_lock_height\030\n"
" \001(\004\022\020\n\010covenant\030\013 \001(\014\022\026\n\016encrypted_data"
"\030\014 \001(\014\022\035\n\025minimum_value_promise\030\r \001(\004b\006p"
"roto3"
"\030\014 \001(\014\022\035\n\025minimum_value_promise\030\r \001(\004\022)\n"
"\013range_proof\030\016 \001(\0132\024.tari.rpc.RangeProof"
"b\006proto3"
};
static const ::_pbi::DescriptorTable* const descriptor_table_transaction_2eproto_deps[2] =
{
@@ -518,7 +522,7 @@ static ::absl::once_flag descriptor_table_transaction_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_transaction_2eproto = {
false,
false,
1805,
1848,
descriptor_table_protodef_transaction_2eproto,
"transaction.proto",
&descriptor_table_transaction_2eproto_once,
@@ -2988,6 +2992,11 @@ void UnblindedOutput::clear_metadata_signature() {
if (_impl_.metadata_signature_ != nullptr) _impl_.metadata_signature_->Clear();
_impl_._has_bits_[0] &= ~0x00000002u;
}
void UnblindedOutput::clear_range_proof() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
if (_impl_.range_proof_ != nullptr) _impl_.range_proof_->Clear();
_impl_._has_bits_[0] &= ~0x00000004u;
}
UnblindedOutput::UnblindedOutput(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(arena) {
SharedCtor(arena);
@@ -3022,6 +3031,9 @@ UnblindedOutput::UnblindedOutput(
_impl_.metadata_signature_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::tari::rpc::ComAndPubSignature>(
arena, *from._impl_.metadata_signature_)
: nullptr;
_impl_.range_proof_ = (cached_has_bits & 0x00000004u) ? ::google::protobuf::Message::CopyConstruct<::tari::rpc::RangeProof>(
arena, *from._impl_.range_proof_)
: nullptr;
::memcpy(reinterpret_cast<char *>(&_impl_) +
offsetof(Impl_, value_),
reinterpret_cast<const char *>(&from._impl_) +
@@ -3069,6 +3081,7 @@ inline void UnblindedOutput::SharedDtor() {
_impl_.encrypted_data_.Destroy();
delete _impl_.features_;
delete _impl_.metadata_signature_;
delete _impl_.range_proof_;
_impl_.~Impl_();
}
@@ -3101,7 +3114,7 @@ PROTOBUF_NOINLINE void UnblindedOutput::Clear() {
_impl_.covenant_.ClearToEmpty();
_impl_.encrypted_data_.ClearToEmpty();
cached_has_bits = _impl_._has_bits_[0];
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000007u) {
if (cached_has_bits & 0x00000001u) {
ABSL_DCHECK(_impl_.features_ != nullptr);
_impl_.features_->Clear();
@@ -3110,6 +3123,10 @@ PROTOBUF_NOINLINE void UnblindedOutput::Clear() {
ABSL_DCHECK(_impl_.metadata_signature_ != nullptr);
_impl_.metadata_signature_->Clear();
}
if (cached_has_bits & 0x00000004u) {
ABSL_DCHECK(_impl_.range_proof_ != nullptr);
_impl_.range_proof_->Clear();
}
}
::memset(&_impl_.value_, 0, static_cast<::size_t>(
reinterpret_cast<char*>(&_impl_.minimum_value_promise_) -
@@ -3126,16 +3143,16 @@ const char* UnblindedOutput::_InternalParse(
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
const ::_pbi::TcParseTable<4, 12, 2, 0, 2> UnblindedOutput::_table_ = {
const ::_pbi::TcParseTable<4, 13, 3, 0, 2> UnblindedOutput::_table_ = {
{
PROTOBUF_FIELD_OFFSET(UnblindedOutput, _impl_._has_bits_),
0, // no _extensions_
13, 120, // max_field_number, fast_idx_mask
14, 120, // max_field_number, fast_idx_mask
offsetof(decltype(_table_), field_lookup_table),
4294959136, // skipmap
4294950944, // skipmap
offsetof(decltype(_table_), field_entries),
12, // num_field_entries
2, // num_aux_entries
13, // num_field_entries
3, // num_aux_entries
offsetof(decltype(_table_), aux_entries),
&_UnblindedOutput_default_instance_._instance,
::_pbi::TcParser::GenericFallback, // fallback
@@ -3181,7 +3198,9 @@ const ::_pbi::TcParseTable<4, 12, 2, 0, 2> UnblindedOutput::_table_ = {
// uint64 minimum_value_promise = 13;
{::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(UnblindedOutput, _impl_.minimum_value_promise_), 63>(),
{104, 63, 0, PROTOBUF_FIELD_OFFSET(UnblindedOutput, _impl_.minimum_value_promise_)}},
{::_pbi::TcParser::MiniParse, {}},
// .tari.rpc.RangeProof range_proof = 14;
{::_pbi::TcParser::FastMtS1,
{114, 2, 2, PROTOBUF_FIELD_OFFSET(UnblindedOutput, _impl_.range_proof_)}},
{::_pbi::TcParser::MiniParse, {}},
}}, {{
65535, 65535
@@ -3222,9 +3241,13 @@ const ::_pbi::TcParseTable<4, 12, 2, 0, 2> UnblindedOutput::_table_ = {
// uint64 minimum_value_promise = 13;
{PROTOBUF_FIELD_OFFSET(UnblindedOutput, _impl_.minimum_value_promise_), -1, 0,
(0 | ::_fl::kFcSingular | ::_fl::kUInt64)},
// .tari.rpc.RangeProof range_proof = 14;
{PROTOBUF_FIELD_OFFSET(UnblindedOutput, _impl_.range_proof_), _Internal::kHasBitsOffset + 2, 2,
(0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)},
}}, {{
{::_pbi::TcParser::GetTable<::tari::rpc::OutputFeatures>()},
{::_pbi::TcParser::GetTable<::tari::rpc::ComAndPubSignature>()},
{::_pbi::TcParser::GetTable<::tari::rpc::RangeProof>()},
}}, {{
}},
};
@@ -3312,6 +3335,12 @@ const ::_pbi::TcParseTable<4, 12, 2, 0, 2> UnblindedOutput::_table_ = {
13, this->_internal_minimum_value_promise(), target);
}
// .tari.rpc.RangeProof range_proof = 14;
if (cached_has_bits & 0x00000004u) {
target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage(
14, *_impl_.range_proof_, _impl_.range_proof_->GetCachedSize(), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target =
::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
@@ -3372,7 +3401,7 @@ const ::_pbi::TcParseTable<4, 12, 2, 0, 2> UnblindedOutput::_table_ = {
}
cached_has_bits = _impl_._has_bits_[0];
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000007u) {
// .tari.rpc.OutputFeatures features = 3;
if (cached_has_bits & 0x00000001u) {
total_size +=
@@ -3385,6 +3414,12 @@ const ::_pbi::TcParseTable<4, 12, 2, 0, 2> UnblindedOutput::_table_ = {
1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.metadata_signature_);
}
// .tari.rpc.RangeProof range_proof = 14;
if (cached_has_bits & 0x00000004u) {
total_size +=
1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.range_proof_);
}
}
// uint64 value = 1;
if (this->_internal_value() != 0) {
@@ -3439,7 +3474,7 @@ void UnblindedOutput::MergeImpl(::google::protobuf::MessageLite& to_msg, const :
_this->_internal_set_encrypted_data(from._internal_encrypted_data());
}
cached_has_bits = from._impl_._has_bits_[0];
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000007u) {
if (cached_has_bits & 0x00000001u) {
ABSL_DCHECK(from._impl_.features_ != nullptr);
if (_this->_impl_.features_ == nullptr) {
@@ -3458,6 +3493,15 @@ void UnblindedOutput::MergeImpl(::google::protobuf::MessageLite& to_msg, const :
_this->_impl_.metadata_signature_->MergeFrom(*from._impl_.metadata_signature_);
}
}
if (cached_has_bits & 0x00000004u) {
ABSL_DCHECK(from._impl_.range_proof_ != nullptr);
if (_this->_impl_.range_proof_ == nullptr) {
_this->_impl_.range_proof_ =
::google::protobuf::Message::CopyConstruct<::tari::rpc::RangeProof>(arena, *from._impl_.range_proof_);
} else {
_this->_impl_.range_proof_->MergeFrom(*from._impl_.range_proof_);
}
}
}
if (from._internal_value() != 0) {
_this->_impl_.value_ = from._impl_.value_;
+109 -1
View File
@@ -737,6 +737,7 @@ class UnblindedOutput final : public ::google::protobuf::Message
kEncryptedDataFieldNumber = 12,
kFeaturesFieldNumber = 3,
kMetadataSignatureFieldNumber = 9,
kRangeProofFieldNumber = 14,
kValueFieldNumber = 1,
kScriptLockHeightFieldNumber = 10,
kMinimumValuePromiseFieldNumber = 13,
@@ -882,6 +883,21 @@ class UnblindedOutput final : public ::google::protobuf::Message
const ::tari::rpc::ComAndPubSignature& _internal_metadata_signature() const;
::tari::rpc::ComAndPubSignature* _internal_mutable_metadata_signature();
public:
// .tari.rpc.RangeProof range_proof = 14;
bool has_range_proof() const;
void clear_range_proof() ;
const ::tari::rpc::RangeProof& range_proof() const;
PROTOBUF_NODISCARD ::tari::rpc::RangeProof* release_range_proof();
::tari::rpc::RangeProof* mutable_range_proof();
void set_allocated_range_proof(::tari::rpc::RangeProof* value);
void unsafe_arena_set_allocated_range_proof(::tari::rpc::RangeProof* value);
::tari::rpc::RangeProof* unsafe_arena_release_range_proof();
private:
const ::tari::rpc::RangeProof& _internal_range_proof() const;
::tari::rpc::RangeProof* _internal_mutable_range_proof();
public:
// uint64 value = 1;
void clear_value() ;
@@ -918,7 +934,7 @@ class UnblindedOutput final : public ::google::protobuf::Message
class _Internal;
friend class ::google::protobuf::internal::TcParser;
static const ::google::protobuf::internal::TcParseTable<
4, 12, 2,
4, 13, 3,
0, 2>
_table_;
friend class ::google::protobuf::MessageLite;
@@ -945,6 +961,7 @@ class UnblindedOutput final : public ::google::protobuf::Message
::google::protobuf::internal::ArenaStringPtr encrypted_data_;
::tari::rpc::OutputFeatures* features_;
::tari::rpc::ComAndPubSignature* metadata_signature_;
::tari::rpc::RangeProof* range_proof_;
::uint64_t value_;
::uint64_t script_lock_height_;
::uint64_t minimum_value_promise_;
@@ -5045,6 +5062,97 @@ inline void UnblindedOutput::_internal_set_minimum_value_promise(::uint64_t valu
_impl_.minimum_value_promise_ = value;
}
// .tari.rpc.RangeProof range_proof = 14;
inline bool UnblindedOutput::has_range_proof() const {
bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0;
PROTOBUF_ASSUME(!value || _impl_.range_proof_ != nullptr);
return value;
}
inline const ::tari::rpc::RangeProof& UnblindedOutput::_internal_range_proof() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
const ::tari::rpc::RangeProof* p = _impl_.range_proof_;
return p != nullptr ? *p : reinterpret_cast<const ::tari::rpc::RangeProof&>(::tari::rpc::_RangeProof_default_instance_);
}
inline const ::tari::rpc::RangeProof& UnblindedOutput::range_proof() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
// @@protoc_insertion_point(field_get:tari.rpc.UnblindedOutput.range_proof)
return _internal_range_proof();
}
inline void UnblindedOutput::unsafe_arena_set_allocated_range_proof(::tari::rpc::RangeProof* value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
if (GetArena() == nullptr) {
delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.range_proof_);
}
_impl_.range_proof_ = reinterpret_cast<::tari::rpc::RangeProof*>(value);
if (value != nullptr) {
_impl_._has_bits_[0] |= 0x00000004u;
} else {
_impl_._has_bits_[0] &= ~0x00000004u;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tari.rpc.UnblindedOutput.range_proof)
}
inline ::tari::rpc::RangeProof* UnblindedOutput::release_range_proof() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] &= ~0x00000004u;
::tari::rpc::RangeProof* released = _impl_.range_proof_;
_impl_.range_proof_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
auto* old = reinterpret_cast<::google::protobuf::MessageLite*>(released);
released = ::google::protobuf::internal::DuplicateIfNonNull(released);
if (GetArena() == nullptr) {
delete old;
}
#else // PROTOBUF_FORCE_COPY_IN_RELEASE
if (GetArena() != nullptr) {
released = ::google::protobuf::internal::DuplicateIfNonNull(released);
}
#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
return released;
}
inline ::tari::rpc::RangeProof* UnblindedOutput::unsafe_arena_release_range_proof() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
// @@protoc_insertion_point(field_release:tari.rpc.UnblindedOutput.range_proof)
_impl_._has_bits_[0] &= ~0x00000004u;
::tari::rpc::RangeProof* temp = _impl_.range_proof_;
_impl_.range_proof_ = nullptr;
return temp;
}
inline ::tari::rpc::RangeProof* UnblindedOutput::_internal_mutable_range_proof() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
if (_impl_.range_proof_ == nullptr) {
auto* p = ::google::protobuf::Message::DefaultConstruct<::tari::rpc::RangeProof>(GetArena());
_impl_.range_proof_ = reinterpret_cast<::tari::rpc::RangeProof*>(p);
}
return _impl_.range_proof_;
}
inline ::tari::rpc::RangeProof* UnblindedOutput::mutable_range_proof() ABSL_ATTRIBUTE_LIFETIME_BOUND {
_impl_._has_bits_[0] |= 0x00000004u;
::tari::rpc::RangeProof* _msg = _internal_mutable_range_proof();
// @@protoc_insertion_point(field_mutable:tari.rpc.UnblindedOutput.range_proof)
return _msg;
}
inline void UnblindedOutput::set_allocated_range_proof(::tari::rpc::RangeProof* value) {
::google::protobuf::Arena* message_arena = GetArena();
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
if (message_arena == nullptr) {
delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.range_proof_);
}
if (value != nullptr) {
::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::MessageLite*>(value)->GetArena();
if (message_arena != submessage_arena) {
value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena);
}
_impl_._has_bits_[0] |= 0x00000004u;
} else {
_impl_._has_bits_[0] &= ~0x00000004u;
}
_impl_.range_proof_ = reinterpret_cast<::tari::rpc::RangeProof*>(value);
// @@protoc_insertion_point(field_set_allocated:tari.rpc.UnblindedOutput.range_proof)
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__
+2
View File
@@ -178,5 +178,7 @@ message UnblindedOutput {
bytes encrypted_data = 12;
// The minimum value of the commitment that is proven by the range proof (in MicroMinotari)
uint64 minimum_value_promise = 13;
// The range proof
RangeProof range_proof = 14;
}
+72 -50
View File
@@ -302,7 +302,7 @@ inline constexpr ConsensusConstants::Impl_::Impl_(
block_weight_inputs_{::uint64_t{0u}},
block_weight_outputs_{::uint64_t{0u}},
block_weight_kernels_{::uint64_t{0u}},
faucet_value_{::uint64_t{0u}},
pre_mine_value_{::uint64_t{0u}},
max_script_byte_size_{::uint64_t{0u}},
validator_node_validity_period_{::uint64_t{0u}},
effective_from_height_{::uint64_t{0u}},
@@ -313,6 +313,7 @@ inline constexpr ConsensusConstants::Impl_::Impl_(
validator_node_registration_shuffle_interval_epoch_{::uint64_t{0u}},
inflation_bips_{::uint64_t{0u}},
tail_epoch_length_{::uint64_t{0u}},
max_block_coinbase_count_{::uint64_t{0u}},
blockchain_version_{0u} {}
template <typename>
@@ -486,7 +487,7 @@ const ::uint32_t
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.block_weight_inputs_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.block_weight_outputs_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.block_weight_kernels_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.faucet_value_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.pre_mine_value_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.max_script_byte_size_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.validator_node_validity_period_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.effective_from_height_),
@@ -505,6 +506,7 @@ const ::uint32_t
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.permitted_range_proof_types_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.inflation_bips_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.tail_epoch_length_),
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.max_block_coinbase_count_),
~0u,
~0u,
~0u,
@@ -538,6 +540,7 @@ const ::uint32_t
~0u,
~0u,
~0u,
~0u,
};
static const ::_pbi::MigrationSchema
@@ -554,7 +557,7 @@ static const ::_pbi::MigrationSchema
{96, -1, -1, sizeof(::tari::rpc::PermittedRangeProofs)},
{106, -1, -1, sizeof(::tari::rpc::RangeProof)},
{115, 125, -1, sizeof(::tari::rpc::ConsensusConstants_ProofOfWorkEntry_DoNotUse)},
{127, 168, -1, sizeof(::tari::rpc::ConsensusConstants)},
{127, 169, -1, sizeof(::tari::rpc::ConsensusConstants)},
};
static const ::_pb::Message* const file_default_instances[] = {
&::tari::rpc::_Range_default_instance_._instance,
@@ -593,7 +596,7 @@ const char descriptor_table_protodef_types_2eproto[] ABSL_ATTRIBUTE_SECTION_VARI
"output_type\030\001 \001(\0162\024.tari.rpc.OutputType\022"
"3\n\021range_proof_types\030\002 \003(\0162\030.tari.rpc.Ra"
"ngeProofType\"!\n\nRangeProof\022\023\n\013proof_byte"
"s\030\001 \001(\014\"\327\n\n\022ConsensusConstants\022\035\n\025coinba"
"s\030\001 \001(\014\"\373\n\n\022ConsensusConstants\022\035\n\025coinba"
"se_min_maturity\030\001 \001(\004\022\032\n\022blockchain_vers"
"ion\030\002 \001(\r\022\031\n\021future_time_limit\030\003 \001(\004\022\037\n\027"
"difficulty_block_window\030\005 \001(\004\022$\n\034max_blo"
@@ -604,41 +607,41 @@ const char descriptor_table_protodef_types_2eproto[] ABSL_ATTRIBUTE_SECTION_VARI
"\022 \n\030min_sha3x_pow_difficulty\030\r \001(\004\022\033\n\023bl"
"ock_weight_inputs\030\016 \001(\004\022\034\n\024block_weight_"
"outputs\030\017 \001(\004\022\034\n\024block_weight_kernels\030\020 "
"\001(\004\022\024\n\014faucet_value\030\021 \001(\004\022\034\n\024max_script_"
"byte_size\030\022 \001(\004\022&\n\036validator_node_validi"
"ty_period\030\023 \001(\004\022\035\n\025effective_from_height"
"\030\024 \001(\004\0227\n\036valid_blockchain_version_range"
"\030\025 \001(\0132\017.tari.rpc.Range\022\037\n\027max_randomx_s"
"eed_height\030\026 \001(\004\022D\n\rproof_of_work\030\027 \003(\0132"
"-.tari.rpc.ConsensusConstants.ProofOfWor"
"kEntry\0222\n\022transaction_weight\030\030 \001(\0132\026.tar"
"i.rpc.WeightParams\022,\n\023input_version_rang"
"e\030\032 \001(\0132\017.tari.rpc.Range\0226\n\024output_versi"
"on_range\030\033 \001(\0132\030.tari.rpc.OutputsVersion"
"\022-\n\024kernel_version_range\030\034 \001(\0132\017.tari.rp"
"c.Range\0224\n\026permitted_output_types\030\035 \003(\0162"
"\024.tari.rpc.OutputType\022\024\n\014epoch_length\030\036 "
"\001(\004\0226\n.validator_node_registration_min_d"
"eposit_amount\030\037 \001(\004\0223\n+validator_node_re"
"gistration_min_lock_height\030 \001(\004\022:\n2vali"
"dator_node_registration_shuffle_interval"
"_epoch\030! \001(\004\022C\n\033permitted_range_proof_ty"
"pes\030\" \003(\0132\036.tari.rpc.PermittedRangeProof"
"s\022\026\n\016inflation_bips\030# \001(\004\022\031\n\021tail_epoch_"
"length\030$ \001(\004\032S\n\020ProofOfWorkEntry\022\013\n\003key\030"
"\001 \001(\r\022.\n\005value\030\002 \001(\0132\037.tari.rpc.PowAlgor"
"ithmConstants:\0028\001*s\n\nOutputType\022\014\n\010STAND"
"ARD\020\000\022\014\n\010COINBASE\020\001\022\010\n\004BURN\020\002\022\037\n\033VALIDAT"
"OR_NODE_REGISTRATION\020\003\022\036\n\032CODE_TEMPLATE_"
"REGISTRATION\020\004*:\n\016RangeProofType\022\024\n\020BULL"
"ETPROOF_PLUS\020\000\022\022\n\016REVEALED_VALUE\020\001b\006prot"
"o3"
"\001(\004\022\026\n\016pre_mine_value\030\021 \001(\004\022\034\n\024max_scrip"
"t_byte_size\030\022 \001(\004\022&\n\036validator_node_vali"
"dity_period\030\023 \001(\004\022\035\n\025effective_from_heig"
"ht\030\024 \001(\004\0227\n\036valid_blockchain_version_ran"
"ge\030\025 \001(\0132\017.tari.rpc.Range\022\037\n\027max_randomx"
"_seed_height\030\026 \001(\004\022D\n\rproof_of_work\030\027 \003("
"\0132-.tari.rpc.ConsensusConstants.ProofOfW"
"orkEntry\0222\n\022transaction_weight\030\030 \001(\0132\026.t"
"ari.rpc.WeightParams\022,\n\023input_version_ra"
"nge\030\032 \001(\0132\017.tari.rpc.Range\0226\n\024output_ver"
"sion_range\030\033 \001(\0132\030.tari.rpc.OutputsVersi"
"on\022-\n\024kernel_version_range\030\034 \001(\0132\017.tari."
"rpc.Range\0224\n\026permitted_output_types\030\035 \003("
"\0162\024.tari.rpc.OutputType\022\024\n\014epoch_length\030"
"\036 \001(\004\0226\n.validator_node_registration_min"
"_deposit_amount\030\037 \001(\004\0223\n+validator_node_"
"registration_min_lock_height\030 \001(\004\022:\n2va"
"lidator_node_registration_shuffle_interv"
"al_epoch\030! \001(\004\022C\n\033permitted_range_proof_"
"types\030\" \003(\0132\036.tari.rpc.PermittedRangePro"
"ofs\022\026\n\016inflation_bips\030# \001(\004\022\031\n\021tail_epoc"
"h_length\030$ \001(\004\022 \n\030max_block_coinbase_cou"
"nt\030% \001(\004\032S\n\020ProofOfWorkEntry\022\013\n\003key\030\001 \001("
"\r\022.\n\005value\030\002 \001(\0132\037.tari.rpc.PowAlgorithm"
"Constants:\0028\001*s\n\nOutputType\022\014\n\010STANDARD\020"
"\000\022\014\n\010COINBASE\020\001\022\010\n\004BURN\020\002\022\037\n\033VALIDATOR_N"
"ODE_REGISTRATION\020\003\022\036\n\032CODE_TEMPLATE_REGI"
"STRATION\020\004*:\n\016RangeProofType\022\024\n\020BULLETPR"
"OOF_PLUS\020\000\022\022\n\016REVEALED_VALUE\020\001b\006proto3"
};
static ::absl::once_flag descriptor_table_types_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_types_2eproto = {
false,
false,
2362,
2398,
descriptor_table_protodef_types_2eproto,
"types.proto",
&descriptor_table_types_2eproto_once,
@@ -3217,15 +3220,15 @@ const char* ConsensusConstants::_InternalParse(
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
const ::_pbi::TcParseTable<5, 33, 8, 0, 7> ConsensusConstants::_table_ = {
const ::_pbi::TcParseTable<5, 34, 8, 0, 7> ConsensusConstants::_table_ = {
{
PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_._has_bits_),
0, // no _extensions_
36, 248, // max_field_number, fast_idx_mask
37, 248, // max_field_number, fast_idx_mask
offsetof(decltype(_table_), field_lookup_table),
16777256, // skipmap
offsetof(decltype(_table_), field_entries),
33, // num_field_entries
34, // num_field_entries
8, // num_aux_entries
offsetof(decltype(_table_), aux_entries),
&_ConsensusConstants_default_instance_._instance,
@@ -3279,9 +3282,9 @@ const ::_pbi::TcParseTable<5, 33, 8, 0, 7> ConsensusConstants::_table_ = {
// uint64 block_weight_kernels = 16;
{::_pbi::TcParser::FastV64S2,
{384, 63, 0, PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.block_weight_kernels_)}},
// uint64 faucet_value = 17;
// uint64 pre_mine_value = 17;
{::_pbi::TcParser::FastV64S2,
{392, 63, 0, PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.faucet_value_)}},
{392, 63, 0, PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.pre_mine_value_)}},
// uint64 max_script_byte_size = 18;
{::_pbi::TcParser::FastV64S2,
{400, 63, 0, PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.max_script_byte_size_)}},
@@ -3322,7 +3325,7 @@ const ::_pbi::TcParseTable<5, 33, 8, 0, 7> ConsensusConstants::_table_ = {
{504, 63, 0, PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.validator_node_registration_min_deposit_amount_)}},
}}, {{
33, 0, 1,
65520, 29,
65504, 29,
65535, 65535
}}, {{
// uint64 coinbase_min_maturity = 1;
@@ -3367,8 +3370,8 @@ const ::_pbi::TcParseTable<5, 33, 8, 0, 7> ConsensusConstants::_table_ = {
// uint64 block_weight_kernels = 16;
{PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.block_weight_kernels_), -1, 0,
(0 | ::_fl::kFcSingular | ::_fl::kUInt64)},
// uint64 faucet_value = 17;
{PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.faucet_value_), -1, 0,
// uint64 pre_mine_value = 17;
{PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.pre_mine_value_), -1, 0,
(0 | ::_fl::kFcSingular | ::_fl::kUInt64)},
// uint64 max_script_byte_size = 18;
{PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.max_script_byte_size_), -1, 0,
@@ -3424,6 +3427,9 @@ const ::_pbi::TcParseTable<5, 33, 8, 0, 7> ConsensusConstants::_table_ = {
// uint64 tail_epoch_length = 36;
{PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.tail_epoch_length_), -1, 0,
(0 | ::_fl::kFcSingular | ::_fl::kUInt64)},
// uint64 max_block_coinbase_count = 37;
{PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.max_block_coinbase_count_), -1, 0,
(0 | ::_fl::kFcSingular | ::_fl::kUInt64)},
}}, {{
{::_pbi::TcParser::GetTable<::tari::rpc::Range>()},
{::_pbi::TcParser::GetMapAuxInfo<
@@ -3547,11 +3553,11 @@ const ::_pbi::TcParseTable<5, 33, 8, 0, 7> ConsensusConstants::_table_ = {
16, this->_internal_block_weight_kernels(), target);
}
// uint64 faucet_value = 17;
if (this->_internal_faucet_value() != 0) {
// uint64 pre_mine_value = 17;
if (this->_internal_pre_mine_value() != 0) {
target = stream->EnsureSpace(target);
target = ::_pbi::WireFormatLite::WriteUInt64ToArray(
17, this->_internal_faucet_value(), target);
17, this->_internal_pre_mine_value(), target);
}
// uint64 max_script_byte_size = 18;
@@ -3696,6 +3702,13 @@ const ::_pbi::TcParseTable<5, 33, 8, 0, 7> ConsensusConstants::_table_ = {
36, this->_internal_tail_epoch_length(), target);
}
// uint64 max_block_coinbase_count = 37;
if (this->_internal_max_block_coinbase_count() != 0) {
target = stream->EnsureSpace(target);
target = ::_pbi::WireFormatLite::WriteUInt64ToArray(
37, this->_internal_max_block_coinbase_count(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target =
::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
@@ -3860,10 +3873,10 @@ const ::_pbi::TcParseTable<5, 33, 8, 0, 7> ConsensusConstants::_table_ = {
this->_internal_block_weight_kernels());
}
// uint64 faucet_value = 17;
if (this->_internal_faucet_value() != 0) {
// uint64 pre_mine_value = 17;
if (this->_internal_pre_mine_value() != 0) {
total_size += 2 + ::_pbi::WireFormatLite::UInt64Size(
this->_internal_faucet_value());
this->_internal_pre_mine_value());
}
// uint64 max_script_byte_size = 18;
@@ -3926,6 +3939,12 @@ const ::_pbi::TcParseTable<5, 33, 8, 0, 7> ConsensusConstants::_table_ = {
this->_internal_tail_epoch_length());
}
// uint64 max_block_coinbase_count = 37;
if (this->_internal_max_block_coinbase_count() != 0) {
total_size += 2 + ::_pbi::WireFormatLite::UInt64Size(
this->_internal_max_block_coinbase_count());
}
// uint32 blockchain_version = 2;
if (this->_internal_blockchain_version() != 0) {
total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(
@@ -4034,8 +4053,8 @@ void ConsensusConstants::MergeImpl(::google::protobuf::MessageLite& to_msg, cons
if (from._internal_block_weight_kernels() != 0) {
_this->_impl_.block_weight_kernels_ = from._impl_.block_weight_kernels_;
}
if (from._internal_faucet_value() != 0) {
_this->_impl_.faucet_value_ = from._impl_.faucet_value_;
if (from._internal_pre_mine_value() != 0) {
_this->_impl_.pre_mine_value_ = from._impl_.pre_mine_value_;
}
if (from._internal_max_script_byte_size() != 0) {
_this->_impl_.max_script_byte_size_ = from._impl_.max_script_byte_size_;
@@ -4067,6 +4086,9 @@ void ConsensusConstants::MergeImpl(::google::protobuf::MessageLite& to_msg, cons
if (from._internal_tail_epoch_length() != 0) {
_this->_impl_.tail_epoch_length_ = from._impl_.tail_epoch_length_;
}
if (from._internal_max_block_coinbase_count() != 0) {
_this->_impl_.max_block_coinbase_count_ = from._impl_.max_block_coinbase_count_;
}
if (from._internal_blockchain_version() != 0) {
_this->_impl_.blockchain_version_ = from._impl_.blockchain_version_;
}
+56 -22
View File
@@ -2416,7 +2416,7 @@ class ConsensusConstants final : public ::google::protobuf::Message
kBlockWeightInputsFieldNumber = 14,
kBlockWeightOutputsFieldNumber = 15,
kBlockWeightKernelsFieldNumber = 16,
kFaucetValueFieldNumber = 17,
kPreMineValueFieldNumber = 17,
kMaxScriptByteSizeFieldNumber = 18,
kValidatorNodeValidityPeriodFieldNumber = 19,
kEffectiveFromHeightFieldNumber = 20,
@@ -2427,6 +2427,7 @@ class ConsensusConstants final : public ::google::protobuf::Message
kValidatorNodeRegistrationShuffleIntervalEpochFieldNumber = 33,
kInflationBipsFieldNumber = 35,
kTailEpochLengthFieldNumber = 36,
kMaxBlockCoinbaseCountFieldNumber = 37,
kBlockchainVersionFieldNumber = 2,
};
// repeated uint64 emission_decay = 11;
@@ -2693,14 +2694,14 @@ class ConsensusConstants final : public ::google::protobuf::Message
void _internal_set_block_weight_kernels(::uint64_t value);
public:
// uint64 faucet_value = 17;
void clear_faucet_value() ;
::uint64_t faucet_value() const;
void set_faucet_value(::uint64_t value);
// uint64 pre_mine_value = 17;
void clear_pre_mine_value() ;
::uint64_t pre_mine_value() const;
void set_pre_mine_value(::uint64_t value);
private:
::uint64_t _internal_faucet_value() const;
void _internal_set_faucet_value(::uint64_t value);
::uint64_t _internal_pre_mine_value() const;
void _internal_set_pre_mine_value(::uint64_t value);
public:
// uint64 max_script_byte_size = 18;
@@ -2802,6 +2803,16 @@ class ConsensusConstants final : public ::google::protobuf::Message
::uint64_t _internal_tail_epoch_length() const;
void _internal_set_tail_epoch_length(::uint64_t value);
public:
// uint64 max_block_coinbase_count = 37;
void clear_max_block_coinbase_count() ;
::uint64_t max_block_coinbase_count() const;
void set_max_block_coinbase_count(::uint64_t value);
private:
::uint64_t _internal_max_block_coinbase_count() const;
void _internal_set_max_block_coinbase_count(::uint64_t value);
public:
// uint32 blockchain_version = 2;
void clear_blockchain_version() ;
@@ -2818,7 +2829,7 @@ class ConsensusConstants final : public ::google::protobuf::Message
class _Internal;
friend class ::google::protobuf::internal::TcParser;
static const ::google::protobuf::internal::TcParseTable<
5, 33, 8,
5, 34, 8,
0, 7>
_table_;
friend class ::google::protobuf::MessageLite;
@@ -2862,7 +2873,7 @@ class ConsensusConstants final : public ::google::protobuf::Message
::uint64_t block_weight_inputs_;
::uint64_t block_weight_outputs_;
::uint64_t block_weight_kernels_;
::uint64_t faucet_value_;
::uint64_t pre_mine_value_;
::uint64_t max_script_byte_size_;
::uint64_t validator_node_validity_period_;
::uint64_t effective_from_height_;
@@ -2873,6 +2884,7 @@ class ConsensusConstants final : public ::google::protobuf::Message
::uint64_t validator_node_registration_shuffle_interval_epoch_;
::uint64_t inflation_bips_;
::uint64_t tail_epoch_length_;
::uint64_t max_block_coinbase_count_;
::uint32_t blockchain_version_;
PROTOBUF_TSAN_DECLARE_MEMBER
};
@@ -4302,26 +4314,26 @@ inline void ConsensusConstants::_internal_set_block_weight_kernels(::uint64_t va
_impl_.block_weight_kernels_ = value;
}
// uint64 faucet_value = 17;
inline void ConsensusConstants::clear_faucet_value() {
// uint64 pre_mine_value = 17;
inline void ConsensusConstants::clear_pre_mine_value() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_.faucet_value_ = ::uint64_t{0u};
_impl_.pre_mine_value_ = ::uint64_t{0u};
}
inline ::uint64_t ConsensusConstants::faucet_value() const {
// @@protoc_insertion_point(field_get:tari.rpc.ConsensusConstants.faucet_value)
return _internal_faucet_value();
inline ::uint64_t ConsensusConstants::pre_mine_value() const {
// @@protoc_insertion_point(field_get:tari.rpc.ConsensusConstants.pre_mine_value)
return _internal_pre_mine_value();
}
inline void ConsensusConstants::set_faucet_value(::uint64_t value) {
_internal_set_faucet_value(value);
// @@protoc_insertion_point(field_set:tari.rpc.ConsensusConstants.faucet_value)
inline void ConsensusConstants::set_pre_mine_value(::uint64_t value) {
_internal_set_pre_mine_value(value);
// @@protoc_insertion_point(field_set:tari.rpc.ConsensusConstants.pre_mine_value)
}
inline ::uint64_t ConsensusConstants::_internal_faucet_value() const {
inline ::uint64_t ConsensusConstants::_internal_pre_mine_value() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
return _impl_.faucet_value_;
return _impl_.pre_mine_value_;
}
inline void ConsensusConstants::_internal_set_faucet_value(::uint64_t value) {
inline void ConsensusConstants::_internal_set_pre_mine_value(::uint64_t value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_.faucet_value_ = value;
_impl_.pre_mine_value_ = value;
}
// uint64 max_script_byte_size = 18;
@@ -5146,6 +5158,28 @@ inline void ConsensusConstants::_internal_set_tail_epoch_length(::uint64_t value
_impl_.tail_epoch_length_ = value;
}
// uint64 max_block_coinbase_count = 37;
inline void ConsensusConstants::clear_max_block_coinbase_count() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_.max_block_coinbase_count_ = ::uint64_t{0u};
}
inline ::uint64_t ConsensusConstants::max_block_coinbase_count() const {
// @@protoc_insertion_point(field_get:tari.rpc.ConsensusConstants.max_block_coinbase_count)
return _internal_max_block_coinbase_count();
}
inline void ConsensusConstants::set_max_block_coinbase_count(::uint64_t value) {
_internal_set_max_block_coinbase_count(value);
// @@protoc_insertion_point(field_set:tari.rpc.ConsensusConstants.max_block_coinbase_count)
}
inline ::uint64_t ConsensusConstants::_internal_max_block_coinbase_count() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
return _impl_.max_block_coinbase_count_;
}
inline void ConsensusConstants::_internal_set_max_block_coinbase_count(::uint64_t value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_.max_block_coinbase_count_ = value;
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__
+2 -1
View File
@@ -124,7 +124,7 @@ message ConsensusConstants {
uint64 block_weight_inputs = 14;
uint64 block_weight_outputs = 15;
uint64 block_weight_kernels = 16;
uint64 faucet_value = 17;
uint64 pre_mine_value = 17;
uint64 max_script_byte_size = 18;
uint64 validator_node_validity_period = 19;
uint64 effective_from_height = 20;
@@ -143,4 +143,5 @@ message ConsensusConstants {
repeated PermittedRangeProofs permitted_range_proof_types = 34;
uint64 inflation_bips = 35;
uint64 tail_epoch_length = 36;
uint64 max_block_coinbase_count = 37;
}
+11 -3
View File
@@ -21,6 +21,14 @@
#include <memory.h>
/****************************** MACROS ******************************/
typedef struct {
uint8_t data[64];
uint32_t datalen;
uint32_t padding;
uint64_t bitlen;
uint32_t state[8];
} SHA256_CTX;
#define ROTLEFT(a,b) (((a) << (b)) | ((a) >> (32-(b))))
#define ROTRIGHT(a,b) (((a) >> (b)) | ((a) << (32-(b))))
@@ -85,7 +93,7 @@ static void sha256_transform(SHA256_CTX *ctx, const uint8_t* data)
ctx->state[7] += h;
}
void sha256_init(SHA256_CTX *ctx)
static void sha256_init(SHA256_CTX *ctx)
{
ctx->datalen = 0;
ctx->bitlen = 0;
@@ -99,7 +107,7 @@ void sha256_init(SHA256_CTX *ctx)
ctx->state[7] = 0x5be0cd19;
}
void sha256_update(SHA256_CTX *ctx, const uint8_t* data, uint32_t len)
static void sha256_update(SHA256_CTX *ctx, const uint8_t* data, uint32_t len)
{
uint32_t i;
@@ -114,7 +122,7 @@ void sha256_update(SHA256_CTX *ctx, const uint8_t* data, uint32_t len)
}
}
void sha256_final(SHA256_CTX *ctx, uint8_t* hash)
static void sha256_final(SHA256_CTX *ctx, uint8_t* hash)
{
uint32_t i;
-16
View File
@@ -16,22 +16,6 @@ extern "C" {
/*************************** HEADER FILES ***************************/
#include <stdint.h>
/****************************** MACROS ******************************/
#define SHA256_BLOCK_SIZE 32 // SHA256 outputs a 32 byte digest
typedef struct {
uint8_t data[64];
uint32_t datalen;
uint32_t padding;
uint64_t bitlen;
uint32_t state[8];
} SHA256_CTX;
/*********************** FUNCTION DECLARATIONS **********************/
void sha256_init(SHA256_CTX *ctx);
void sha256_update(SHA256_CTX *ctx, const uint8_t* data, uint32_t len);
void sha256_final(SHA256_CTX *ctx, uint8_t* hash);
void sha256(const void* data, uint32_t len, uint8_t* hash);
#ifdef __cplusplus
-14
View File
@@ -1,14 +0,0 @@
diff --git a/typeinfo b/typeinfo
index 4cce6cb..323fbc1 100644
--- a/typeinfo
+++ b/typeinfo
@@ -189,6 +189,9 @@ namespace std
#endif
#if __GXX_TYPEINFO_EQUALITY_INLINE || __cplusplus > 202002L
+#ifdef __clang__
+ __attribute__((always_inline))
+#endif
_GLIBCXX23_CONSTEXPR inline bool
type_info::operator==(const type_info& __arg) const _GLIBCXX_NOEXCEPT
{
+14
View File
@@ -612,6 +612,20 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
m_poolBlockTemplate->m_auxChains = data.aux_chains;
m_poolBlockTemplate->m_auxNonce = data.aux_nonce;
m_poolBlockTemplate->m_mergeMiningExtra.clear();
for (const AuxChainData& c : data.aux_chains) {
std::vector<uint8_t> v;
v.reserve(HASH_SIZE + 16);
v.assign(c.data.h, c.data.h + HASH_SIZE);
writeVarint(c.difficulty.lo, v);
writeVarint(c.difficulty.hi, v);
m_poolBlockTemplate->m_mergeMiningExtra.emplace(c.unique_id, std::move(v));
}
init_merge_mining_merkle_proof();
const std::vector<uint8_t> sidechain_data = m_poolBlockTemplate->serialize_sidechain_data();
+6
View File
@@ -501,4 +501,10 @@ extern const char* BLOCK_FOUND;
} // namespace p2pool
#include "util.h"
#ifdef DEBUG_BUILD
#undef FORCEINLINE
#define FORCEINLINE NOINLINE
#endif
#include "log.h"
+55 -35
View File
@@ -84,20 +84,30 @@ ConsoleCommands::ConsoleCommands(p2pool* pool)
}
}
std::random_device rd;
for (int i = 0; i < 10; ++i) {
if (start_listening(false, "127.0.0.1", 49152 + (rd() % 16384))) {
break;
}
}
if (m_listenPort < 0) {
LOGERR(1, "failed to listen on TCP port");
throw std::exception();
}
if (m_pool->api() && m_pool->params().m_localStats) {
std::mt19937_64 rng(RandomDeviceSeed::instance);
// Diffuse the initial state in case it has low quality
rng.discard(10000);
for (int i = 0; i < 10; ++i) {
if (start_listening(false, "127.0.0.1", 49152 + (rng() % 16384))) {
break;
}
}
if (m_listenPort < 0) {
LOGERR(1, "failed to listen on TCP port");
throw std::exception();
}
// 20 random characters in the range [32, 126] should be enough for 128 bits of entropy
m_cookie.resize(20);
for (char& c : m_cookie) {
c = static_cast<char>(rng() % (127 - 32) + 32);
}
m_pool->api()->set(p2pool_api::Category::LOCAL, "console",
[stdin_type, this](log::Stream& s)
{
@@ -113,7 +123,7 @@ ConsoleCommands::ConsoleCommands(p2pool* pool)
s << static_cast<int>(stdin_type);
}
s << "\",\"tcp_port\":" << m_listenPort << '}';
s << "\",\"tcp_port\":" << m_listenPort << ",\"cookie\":\"" << log::EscapedString(m_cookie) << "\"}";
});
}
@@ -348,7 +358,7 @@ void ConsoleCommands::stdinReadCallback(uv_stream_t* stream, ssize_t nread, cons
ConsoleCommands* pThis = static_cast<ConsoleCommands*>(stream->data);
if (nread > 0) {
pThis->process_input(pThis->m_command, buf->base, static_cast<uint32_t>(nread));
pThis->process_input(pThis->m_command, buf->base, static_cast<uint32_t>(nread), false);
}
else if (nread < 0) {
LOGWARN(4, "read error " << uv_err_name(static_cast<int>(nread)));
@@ -358,7 +368,7 @@ void ConsoleCommands::stdinReadCallback(uv_stream_t* stream, ssize_t nread, cons
}
void ConsoleCommands::process_input(std::string& command, const char* data, uint32_t size)
void ConsoleCommands::process_input(std::string& command, const char* data, uint32_t size, bool check_cookie)
{
command.append(data, size);
@@ -369,31 +379,41 @@ void ConsoleCommands::process_input(std::string& command, const char* data, uint
}
command[k] = '\0';
cmd* c = cmds;
for (; c->name.len; ++c) {
if (!strncmp(command.c_str(), c->name.str, c->name.len)) {
const char* args = (c->name.len + 1 <= k) ? (command.c_str() + c->name.len + 1) : "";
if (check_cookie && ((k <= m_cookie.length()) || (memcmp(command.data(), m_cookie.data(), m_cookie.length()) != 0))) {
LOGWARN(4, "cookie check failed, skipping command " << log::MaskNonASCII(command));
}
else {
if (check_cookie) {
command.erase(0, m_cookie.length());
k -= m_cookie.length();
}
// Skip spaces
while ((args[0] == ' ') || (args[0] == '\t')) {
++args;
}
cmd* c = cmds;
for (; c->name.len; ++c) {
if (!strncmp(command.c_str(), c->name.str, c->name.len)) {
const char* args = (c->name.len + 1 <= k) ? (command.c_str() + c->name.len + 1) : "";
// Check if an argument is required
if (strlen(c->arg) && !strlen(args)) {
LOGWARN(0, c->name.str << " requires arguments");
do_help(nullptr, nullptr);
// Skip spaces
while ((args[0] == ' ') || (args[0] == '\t')) {
++args;
}
// Check if an argument is required
if (strlen(c->arg) && !strlen(args)) {
LOGWARN(0, c->name.str << " requires arguments");
do_help(nullptr, nullptr);
break;
}
c->func(m_pool, args);
break;
}
c->func(m_pool, args);
break;
}
}
if (!c->name.len) {
LOGWARN(0, "Unknown command " << command.c_str());
do_help(nullptr, nullptr);
if (!c->name.len) {
LOGWARN(0, "Unknown command " << log::MaskNonASCII(command));
do_help(nullptr, nullptr);
}
}
k = command.find_first_not_of("\r\n", k + 1);
+4 -3
View File
@@ -40,9 +40,9 @@ public:
size_t size() const override { return sizeof(ConsoleClient); }
bool on_connect() override { return true; };
bool on_read(const char* data, uint32_t size) override { static_cast<ConsoleCommands*>(m_owner)->process_input(m_command, data, size); return true; };
bool on_read(const char* data, uint32_t size) override { static_cast<ConsoleCommands*>(m_owner)->process_input(m_command, data, size, true); return true; };
char m_consoleReadBuf[1024] = {};
alignas(8) char m_consoleReadBuf[1024] = {};
std::string m_command;
};
@@ -62,11 +62,12 @@ private:
bool m_readBufInUse;
std::string m_command;
std::string m_cookie;
static void allocCallback(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf);
static void stdinReadCallback(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf);
void process_input(std::string& command, const char* data, uint32_t size);
void process_input(std::string& command, const char* data, uint32_t size, bool check_cookie);
};
} // namespace p2pool
+8 -4
View File
@@ -80,6 +80,8 @@ struct CurlContext
uint64_t m_startTime;
uint64_t m_connectedTime;
std::string m_proxy;
};
CurlContext::CurlContext(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, bool ssl, const std::string& ssl_fingerprint, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop)
@@ -93,6 +95,7 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string
, m_headers(nullptr)
, m_startTime(0)
, m_connectedTime(0)
, m_proxy(proxy)
{
m_pollHandles.reserve(2);
@@ -111,8 +114,10 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string
(void)ssl_fingerprint;
#endif
const bool is_v6 = (address.find(':') != std::string::npos);
log::Stream s(buf);
s << protocol << address << ':' << port;
s << protocol << (is_v6 ? "[" : "") << address << (is_v6 ? "]:" : ":") << port;
if (!m_req.empty() && (m_req.front() == '/')) {
s << m_req.c_str() << '\0';
@@ -242,9 +247,8 @@ CurlContext::~CurlContext()
double tcp_ping = 0.0;
if (m_error.empty() && !m_response.empty()) {
if (m_connectedTime) {
tcp_ping = static_cast<double>(m_connectedTime - m_startTime) / 1000.0;
}
const uint64_t t = (m_proxy.empty() && m_connectedTime) ? m_connectedTime : microseconds_since_epoch();
tcp_ping = static_cast<double>(t - m_startTime) / 1000.0;
(*m_callback)(m_response.data(), m_response.size(), tcp_ping);
}
delete m_callback;
+63 -11
View File
@@ -24,6 +24,10 @@
#include <stdlib.h>
#include <clocale>
#if defined(_WIN32) && !defined(S_ISREG)
#define S_ISREG(M) (((M) & _S_IFMT) == _S_IFREG)
#endif
#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
@@ -118,6 +122,7 @@ public:
: m_writePos(0)
, m_readPos(0)
, m_stopped(false)
, m_needReopen(false)
{
#if defined(_WIN32) && defined(_MSC_VER) && !defined(NDEBUG)
SetUnhandledExceptionFilter(UnhandledExceptionFilter);
@@ -128,11 +133,6 @@ public:
std::setlocale(LC_ALL, "en_001");
m_logFilePath = DATA_DIR + log_file_name;
m_logFile.open(m_logFilePath, std::ios::app | std::ios::binary);
if (!m_logFile.is_open()) {
fprintf(stderr, "failed to open %s: error %d\n", m_logFilePath.c_str(), errno);
}
m_buf.resize(BUF_SIZE);
@@ -219,6 +219,12 @@ public:
const std::string& log_file_path() const { return m_logFilePath; }
FORCEINLINE void schedule_reopen()
{
m_needReopen = true;
uv_cond_signal(&m_cond);
}
private:
static void init_uv_threadpool()
{
@@ -245,11 +251,41 @@ private:
}
}
bool reopen(struct stat& st)
{
st = {};
if (m_logFile.is_open()) {
m_logFile.close();
}
m_logFile.open(m_logFilePath, std::ios::app | std::ios::binary);
if (!m_logFile.is_open()) {
return false;
}
if (stat(m_logFilePath.c_str(), &st) != 0) {
st = {};
return false;
}
return true;
}
private:
static void run_wrapper(void* arg) { reinterpret_cast<Worker*>(arg)->run(); }
NOINLINE void run()
{
set_thread_name("Logger");
struct stat log_file_st;
if (!reopen(log_file_st)) {
fprintf(stderr, "failed to open %s: error %d\n", m_logFilePath.c_str(), errno);
}
do {
uv_mutex_lock(&m_mutex);
if (m_readPos == m_writePos.load()) {
@@ -262,6 +298,14 @@ private:
}
uv_mutex_unlock(&m_mutex);
bool expected = true;
if (m_needReopen.compare_exchange_strong(expected, false)) {
// Reopen the log file on request (logrotate support)
if(reopen(log_file_st)) {
LOGINFO(0, "reopened " << m_logFilePath);
}
}
for (uint32_t writePos = m_writePos.load(); m_readPos != writePos; writePos = m_writePos.load()) {
// We have at least one log slot pending, possibly more than one
// Process everything in a loop before reading m_writePos again
@@ -325,11 +369,18 @@ private:
if (m_logFile.is_open()) {
m_logFile.flush();
// Reopen the log file if it's been moved (logrotate support)
// Automatically reopen the file if either it
// no longer exists or it is now a different
// regular file; this detects manual moving or
// recreating of the file
struct stat buf;
if (stat(m_logFilePath.c_str(), &buf) != 0) {
m_logFile.close();
m_logFile.open(m_logFilePath, std::ios::app | std::ios::binary);
if (stat(m_logFilePath.c_str(), &buf) == 0) {
if(log_file_st.st_dev && log_file_st.st_ino && S_ISREG(buf.st_mode) &&
(buf.st_dev != log_file_st.st_dev || buf.st_ino != log_file_st.st_ino)) {
reopen(log_file_st);
}
} else if(errno == ENOENT) {
reopen(log_file_st);
}
}
@@ -367,13 +418,14 @@ private:
std::vector<char> m_buf;
std::atomic<uint32_t> m_writePos;
uint32_t m_readPos;
std::atomic<uint32_t> m_readPos;
uv_cond_t m_cond;
uv_mutex_t m_mutex;
uv_thread_t m_worker;
bool m_stopped;
std::atomic<bool> m_needReopen;
std::ofstream m_logFile;
std::string m_logFilePath;
@@ -443,7 +495,7 @@ void reopen()
{
// This will trigger the worker thread which will then reopen log file if it's been moved
#ifndef P2POOL_LOG_DISABLE
LOGINFO(0, "reopening " << worker->log_file_path());
worker->schedule_reopen();
#endif
}
+46 -1
View File
@@ -344,7 +344,7 @@ template<> struct log::Stream::Entry<Hashrate>
const double x = static_cast<double>(value.m_data);
static constexpr const char* units[] = { "H/s", "KH/s", "MH/s", "GH/s", "TH/s", "PH/s", "EH/s" };
static constexpr const char* units[] = { "H/s", "kH/s", "MH/s", "GH/s", "TH/s", "PH/s", "EH/s" };
int n;
char buf[32];
@@ -435,6 +435,51 @@ template<> struct log::Stream::Entry<Duration>
}
};
struct EscapedString
{
explicit FORCEINLINE EscapedString(const std::string& data, const char* characters_to_escape = "\"\\", char escape_character = '\\')
{
m_data.reserve(data.length() * 2);
for (const char c : data) {
if (strchr(characters_to_escape, c)) {
m_data.append(1, escape_character);
}
m_data.append(1, c);
}
}
FORCEINLINE operator const std::string&() const { return m_data; }
std::string m_data;
};
template<> struct log::Stream::Entry<EscapedString>
{
static FORCEINLINE void put(const EscapedString& value, Stream* wrapper) { *wrapper << value.m_data; }
};
struct MaskNonASCII
{
explicit FORCEINLINE MaskNonASCII(const std::string& data, char mask_character = '?') : m_data(data)
{
for (char& c : m_data) {
if ((c < 32) || (c >= 127)) {
c = mask_character;
}
}
}
FORCEINLINE operator const std::string&() const { return m_data; }
std::string m_data;
};
template<> struct log::Stream::Entry<MaskNonASCII>
{
static FORCEINLINE void put(const MaskNonASCII& value, Stream* wrapper) { *wrapper << value.m_data; }
};
template<typename T>
struct PadRight
{
+61 -13
View File
@@ -21,6 +21,22 @@
#include "stratum_server.h"
#include "p2p_server.h"
#include <curl/curl.h>
#ifdef WITH_GRPC
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4574)
#endif
#include <grpc/grpc.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // WITH_GRPC
#include <filesystem>
#ifdef WITH_RANDOMX
@@ -46,6 +62,7 @@ void p2pool_usage()
"--stratum Comma-separated list of IP:port for stratum server to listen on\n"
"--p2p Comma-separated list of IP:port for p2p server to listen on\n"
"--addpeers Comma-separated list of IP:port of other p2pool nodes to connect to\n"
"--stratum-ban-time N Number of seconds to ban misbehaving stratum client, default is %u\n"
"--light-mode Don't allocate RandomX dataset, saves 2GB of RAM\n"
"--loglevel Verbosity of the log, integer number between 0 and %d\n"
"--data-dir Path to store general p2pool files (log, cache, peer data, etc.), default is current directory\n"
@@ -62,6 +79,7 @@ void p2pool_usage()
"--in-peers N Maximum number of incoming connections for p2p server (any value between 10 and 450)\n"
"--start-mining N Start built-in miner using N threads (any value between 1 and 64)\n"
"--mini Connect to p2pool-mini sidechain. Note that it will also change default p2p port from %d to %d\n"
"--nano Connect to p2pool-nano sidechain. Note that it will also change default p2p port from %d to %d\n"
"--no-autodiff Disable automatic difficulty adjustment for miners connected to stratum (WARNING: incompatible with Nicehash and MRR)\n"
"--rpc-login Specify username[:password] required for Monero RPC server\n"
"--socks5 Specify IP:port of a SOCKS5 proxy to use for outgoing connections\n"
@@ -80,14 +98,17 @@ void p2pool_usage()
"--rpc-ssl Enable SSL on RPC connections to the Monero node\n"
"--rpc-ssl-fingerprint base64-encoded fingerprint of the Monero node's certificate (optional, use it for certificate pinning)\n"
#endif
"--no-stratum-http Disable HTTP on Stratum ports\n"
"--help Show this help message\n\n"
"--no-stratum-http Disable HTTP on Stratum ports\n"
"--help Show this help message\n\n"
"Example command line:\n\n"
"%s --host 127.0.0.1 --rpc-port 18081 --zmq-port 18083 --wallet YOUR_WALLET_ADDRESS --stratum 0.0.0.0:%d --p2p 0.0.0.0:%d\n\n",
p2pool::VERSION,
static_cast<uint32_t>(p2pool::DEFAULT_STRATUM_BAN_TIME),
p2pool::log::MAX_GLOBAL_LOG_LEVEL,
p2pool::DEFAULT_P2P_PORT,
p2pool::DEFAULT_P2P_PORT_MINI,
p2pool::DEFAULT_P2P_PORT,
p2pool::DEFAULT_P2P_PORT_NANO,
#ifdef _WIN32
"p2pool.exe"
#else
@@ -105,24 +126,36 @@ void p2pool_version()
int p2pool_test()
{
printf("Self-test started\n");
#ifdef WITH_RANDOMX
const char myKey[] = "test key 000";
const char myInput[] = "This is a test";
char hash[RANDOMX_HASH_SIZE];
const randomx_flags flags = randomx_get_flags() | RANDOMX_FLAG_FULL_MEM;
randomx_cache* myCache = randomx_alloc_cache(flags);
randomx_cache* myCache = randomx_alloc_cache(flags | RANDOMX_FLAG_LARGE_PAGES);
if (!myCache) {
printf("Cache allocation failed\n");
return 1;
myCache = randomx_alloc_cache(flags);
if (!myCache) {
printf("Cache allocation failed\n");
return 1;
}
}
randomx_init_cache(myCache, myKey, sizeof(myKey) - 1);
printf("RandomX cache allocated\n");
randomx_dataset* myDataset = randomx_alloc_dataset(flags);
randomx_init_cache(myCache, myKey, sizeof(myKey) - 1);
printf("RandomX cache initialized\n");
randomx_dataset* myDataset = randomx_alloc_dataset(flags | RANDOMX_FLAG_LARGE_PAGES);
if (!myDataset) {
printf("Dataset allocation failed\n");
return 1;
myDataset = randomx_alloc_dataset(flags);
if (!myDataset) {
printf("Dataset allocation failed\n");
return 1;
}
}
printf("RandomX dataset allocated\n");
{
const uint32_t numThreads = std::max(std::thread::hardware_concurrency(), 1U);
@@ -143,20 +176,27 @@ int p2pool_test()
t.join();
}
}
printf("RandomX dataset initialized\n");
randomx_release_cache(myCache);
randomx_vm* myMachine = randomx_create_vm(flags, nullptr, myDataset);
randomx_vm* myMachine = randomx_create_vm(flags | RANDOMX_FLAG_LARGE_PAGES, nullptr, myDataset);
if (!myMachine) {
printf("Failed to create a virtual machine");
return 1;
myMachine = randomx_create_vm(flags, nullptr, myDataset);
if (!myMachine) {
printf("Failed to create a virtual machine");
return 1;
}
}
printf("RandomX VM created\n");
memset(hash, 0, sizeof(hash));
memcpy(hash, myInput, sizeof(myInput));
for (size_t i = 0; i < 100; ++i) {
for (int i = 0; i < 100; ++i) {
printf("RandomX: calculating hash %d...", i);
randomx_calculate_hash(myMachine, &hash, sizeof(hash), hash);
printf("done\n");
}
char buf[RANDOMX_HASH_SIZE * 2 + 1] = {};
@@ -239,6 +279,10 @@ int main(int argc, char* argv[])
return result;
}
#ifdef WITH_GRPC
grpc_init();
#endif
try {
p2pool::p2pool pool(argc, argv);
result = pool.run();
@@ -247,6 +291,10 @@ int main(int argc, char* argv[])
result = 1;
}
#ifdef WITH_GRPC
grpc_shutdown();
#endif
curl_global_cleanup();
p2pool::destroy_crypto_cache();
+33 -7
View File
@@ -48,8 +48,10 @@ struct TrackedAllocation
FORCEINLINE bool operator<(const TrackedAllocation& rhs) { return memcmp(stack_trace, rhs.stack_trace, sizeof(stack_trace)) < 0; }
FORCEINLINE bool operator==(const TrackedAllocation& rhs) { return memcmp(stack_trace, rhs.stack_trace, sizeof(stack_trace)) == 0; }
void print(HANDLE h) const
void print(HANDLE h, bool& is_grpc) const
{
is_grpc = false;
char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)] = {};
PSYMBOL_INFO pSymbol = reinterpret_cast<PSYMBOL_INFO>(buffer);
@@ -66,13 +68,21 @@ struct TrackedAllocation
if (SymFromAddr(h, address, &t1, pSymbol) && SymGetLineFromAddr64(h, address, &t2, &line)) {
const char* s = line.FileName;
const char* file_name = nullptr;
while (*s) {
if ((*s == '\\') || (*s == '/')) {
file_name = s + 1;
}
++s;
}
printf("%-25s %s (line %lu)\n", file_name ? file_name : line.FileName, pSymbol->Name, line.LineNumber);
s = pSymbol->Name;
printf("%-25s %s (line %lu)\n", file_name ? file_name : line.FileName, s, line.LineNumber);
if (!is_grpc && ((strstr(s, "grpc::") == s) || (strstr(s, "grpc_core::") == s) || (strstr(s, "grpc_init") == s))) {
is_grpc = true;
}
}
}
printf("\n");
@@ -130,7 +140,8 @@ void show_top_10_allocations()
for (TrackedAllocation* p = buf; (p < buf + 10) && (p < end); ++p) {
printf("%I64u bytes allocated at:\n", p->allocated_size);
p->print(h);
bool is_grpc;
p->print(h, is_grpc);
}
}
@@ -314,21 +325,36 @@ bool memory_tracking_stop()
const HANDLE h = GetCurrentProcess();
uint64_t total_leaks = 0;
uint64_t grpc_leaks = 0;
for (uint32_t i = 0; i < N; ++i) {
const TrackedAllocation& t = allocations[i];
if (t.allocated_size) {
total_leaks += t.allocated_size;
printf("Memory leak detected, %I64u bytes allocated at %p by thread %u:\n", t.allocated_size, t.p, t.thread_id);
t.print(h);
bool is_grpc;
t.print(h, is_grpc);
if (is_grpc) {
printf("^^^ grpc leak ^^^\n\n");
grpc_leaks += t.allocated_size;
}
else {
printf("^^^ non-grpc leak ^^^\n\n");
total_leaks += t.allocated_size;
}
}
}
if (total_leaks > 0) {
printf("%I64u bytes leaked\n\n", total_leaks);
}
else {
if (grpc_leaks > 0) {
printf("%I64u bytes leaked by gRPC\n\n", grpc_leaks);
}
if ((total_leaks == 0) && (grpc_leaks == 0)) {
printf("No memory leaks detected\n\n");
}
+11 -1
View File
@@ -21,16 +21,24 @@ namespace p2pool {
class p2pool;
class BlockTemplate;
struct PoolBlock;
class IMergeMiningClient
{
public:
struct ChainParameters
{
ChainParameters() : last_updated(0) {}
enum {
EXPIRE_TIME = 1800,
};
hash aux_id;
hash aux_hash;
std::vector<uint8_t> aux_blob;
difficulty_type aux_diff;
uint64_t last_updated;
};
public:
@@ -38,9 +46,11 @@ public:
virtual ~IMergeMiningClient() {}
[[nodiscard]] virtual bool get_params(ChainParameters& out_params) const = 0;
virtual void submit_solution(const BlockTemplate* block_tpl, const uint8_t (&hashing_blob)[128], size_t nonce_offset, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path) = 0;
virtual void on_external_block(const PoolBlock& block) = 0;
virtual void submit_solution(const std::vector<uint8_t>& coinbase_merkle_proof, const uint8_t (&hashing_blob)[128], size_t nonce_offset, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path) = 0;
virtual void print_status() const = 0;
virtual void api_status(log::Stream&) const = 0;
};
} // namespace p2pool
+32 -7
View File
@@ -31,6 +31,7 @@ namespace p2pool {
MergeMiningClientJSON_RPC::MergeMiningClientJSON_RPC(p2pool* pool, const std::string& host, const std::string& wallet)
: m_host(host)
, m_port(80)
, m_chainParamsTimestamp(0)
, m_auxWallet(wallet)
, m_ping(0.0)
, m_pool(pool)
@@ -281,13 +282,16 @@ bool MergeMiningClientJSON_RPC::parse_merge_mining_get_aux_block(const char* dat
m_chainParams.aux_hash = h;
m_chainParams.aux_diff.lo = result["aux_diff"].GetUint64();
m_chainParams.aux_diff.hi = 0;
m_chainParams.last_updated = seconds_since_epoch();
m_chainParamsTimestamp = time(nullptr);
changed = true;
return true;
}
void MergeMiningClientJSON_RPC::submit_solution(const BlockTemplate* /*block_tpl*/, const uint8_t (&/*hashing_blob*/)[128], size_t /*nonce_offset*/, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path)
void MergeMiningClientJSON_RPC::submit_solution(const std::vector<uint8_t>& /*coinbase_merkle_proof*/, const uint8_t (&/*hashing_blob*/)[128], size_t /*nonce_offset*/, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path)
{
ReadLock lock(m_lock);
@@ -318,6 +322,8 @@ void MergeMiningClientJSON_RPC::submit_solution(const BlockTemplate* /*block_tpl
if (size > 0) {
LOGERR(3, "couldn't submit merge mining solution to " << m_host << ':' << m_port << ", error " << log::const_buf(data, size));
}
// Get new mining job
on_timer();
}, &m_loop);
}
@@ -332,19 +338,40 @@ void MergeMiningClientJSON_RPC::print_status() const
);
}
bool MergeMiningClientJSON_RPC::get_params(ChainParameters& out_params) const
void MergeMiningClientJSON_RPC::api_status(log::Stream& s) const
{
ReadLock lock(m_lock);
s << '{'
<< "\"api\":\"JSON RPC\","
<< "\"id\":\"" << m_chainParams.aux_id << "\","
<< "\"host\":\"" << m_host << ':' << m_port << "\","
<< "\"wallet\":\"" << m_auxWallet << "\","
<< "\"difficulty\":" << m_chainParams.aux_diff << ","
<< "\"timestamp\":" << m_chainParamsTimestamp
<< '}';
}
bool MergeMiningClientJSON_RPC::get_params(ChainParameters& out_params) const
{
const uint64_t t = seconds_since_epoch();
ReadLock lock(m_lock);
if (m_chainParams.aux_id.empty() || m_chainParams.aux_diff.empty()) {
return false;
}
if (t >= m_chainParams.last_updated + ChainParameters::EXPIRE_TIME) {
LOGWARN(4, m_host << ':' << m_port << " merge mining data is outdated (" << (t - m_chainParams.last_updated) << " seconds old)");
return false;
}
out_params = m_chainParams;
return true;
}
bool MergeMiningClientJSON_RPC::parse_merge_mining_submit_solution(const char* data, size_t size)
bool MergeMiningClientJSON_RPC::parse_merge_mining_submit_solution(const char* data, size_t size) const
{
auto err = [this](const char* msg) {
LOGWARN(3, "merge_mining_submit_solution to " << m_host << ':' << m_port << " failed: " << msg);
@@ -393,10 +420,6 @@ bool MergeMiningClientJSON_RPC::parse_merge_mining_submit_solution(const char* d
}
LOGINFO(0, log::LightGreen() << "merge_mining_submit_solution to " << m_host << ':' << m_port << ": " << status);
// Get new mining job
on_timer();
return true;
}
@@ -404,6 +427,8 @@ void MergeMiningClientJSON_RPC::loop(void* data)
{
LOGINFO(1, "event loop started");
set_thread_name("MM JSON RPC");
MergeMiningClientJSON_RPC* client = static_cast<MergeMiningClientJSON_RPC*>(data);
int err = uv_run(&client->m_loop, UV_RUN_DEFAULT);
+7 -2
View File
@@ -22,6 +22,7 @@
namespace p2pool {
class p2pool;
struct PoolBlock;
class MergeMiningClientJSON_RPC : public IMergeMiningClient
{
@@ -30,9 +31,11 @@ public:
~MergeMiningClientJSON_RPC() override;
bool get_params(ChainParameters& out_params) const override;
void submit_solution(const BlockTemplate* block_tpl, const uint8_t (&hashing_blob)[128], size_t nonce_offset, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path) override;
void on_external_block(const PoolBlock& /*block*/) override {}
void submit_solution(const std::vector<uint8_t>& coinbase_merkle_proof, const uint8_t (&hashing_blob)[128], size_t nonce_offset, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path) override;
void print_status() const override;
void api_status(log::Stream&) const override;
private:
static void loop(void* data);
@@ -46,7 +49,7 @@ private:
void merge_mining_get_aux_block(uint64_t height, const hash& prev_id, const std::string& wallet);
bool parse_merge_mining_get_aux_block(const char* data, size_t size, bool& changed);
bool parse_merge_mining_submit_solution(const char* data, size_t size);
bool parse_merge_mining_submit_solution(const char* data, size_t size) const;
std::string m_host;
uint32_t m_port;
@@ -54,6 +57,8 @@ private:
mutable uv_rwlock_t m_lock;
ChainParameters m_chainParams;
uint64_t m_chainParamsTimestamp;
std::string m_auxWallet;
double m_ping;
+517 -96
View File
@@ -22,6 +22,10 @@
#include "params.h"
#include "block_template.h"
#include "keccak.h"
#include "pool_block.h"
#include "merkle.h"
#include "side_chain.h"
#include <fstream>
LOG_CATEGORY(MergeMiningClientTari)
@@ -31,12 +35,16 @@ namespace p2pool {
MergeMiningClientTari::MergeMiningClientTari(p2pool* pool, std::string host, const std::string& wallet)
: m_chainParams{}
, m_chainParamsTimestamp(0)
, m_previousAuxHashes{}
, m_previousAuxHashesIndex(0)
, m_auxWallet(wallet)
, m_pool(pool)
, m_tariJobParams{}
, m_server(new TariServer(pool->params().m_socks5Proxy))
, m_hostStr(host)
, m_workerStop(0)
, m_pushBlockStop(0)
{
if (host.find(TARI_PREFIX) != 0) {
LOGERR(1, "Invalid host " << host << " - \"" << TARI_PREFIX << "\" prefix not found");
@@ -79,16 +87,54 @@ MergeMiningClientTari::MergeMiningClientTari(p2pool* pool, std::string host, con
log::Stream s(buf);
s << "127.0.0.1:" << m_server->external_listen_port();
m_TariNode = new BaseNode::Stub(grpc::CreateChannel(buf, grpc::InsecureChannelCredentials()));
m_channelArgs.SetInt(GRPC_ARG_INITIAL_RECONNECT_BACKOFF_MS, 1000);
m_channelArgs.SetInt(GRPC_ARG_MIN_RECONNECT_BACKOFF_MS, 1000);
m_channelArgs.SetInt(GRPC_ARG_MAX_RECONNECT_BACKOFF_MS, 10000);
m_channelArgs.SetInt(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, -1);
m_channelArgs.SetInt(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH, -1);
m_TariNode = new BaseNode::Stub(grpc::CreateCustomChannel(buf, grpc::InsecureChannelCredentials(), m_channelArgs));
uv_mutex_init_checked(&m_workerLock);
uv_cond_init_checked(&m_workerCond);
const int err = uv_thread_create(&m_worker, run_wrapper, this);
int err = uv_thread_create(&m_worker, run_wrapper, this);
if (err) {
LOGERR(1, "failed to start worker thread, error " << uv_err_name(err));
throw std::exception();
}
uv_mutex_init_checked(&m_pushBlockLock);
uv_cond_init_checked(&m_pushBlockCond);
std::ifstream f("tari_nodes.txt");
if (f.is_open()) {
while (f.good()) {
std::string node;
std::getline(f, node);
if (!node.empty()) {
PushBlockThreadData* data = new PushBlockThreadData{ {}, this, std::move(node) };
err = uv_thread_create(&data->m_worker, push_block_thread, data);
if (err) {
LOGERR(1, "failed to start block pusher thread for node " << data->m_node << ", error " << uv_err_name(err));
delete data;
}
else {
m_pushBlockThreads.push_back(data);
// Limit to 16 nodes. More will be just an overkill and a waste of bandwidth.
if (m_pushBlockThreads.size() >= 16) {
break;
}
}
}
}
}
}
MergeMiningClientTari::~MergeMiningClientTari()
@@ -102,6 +148,20 @@ MergeMiningClientTari::~MergeMiningClientTari()
}
uv_thread_join(&m_worker);
if (!m_pushBlockThreads.empty()) {
m_pushBlockStop.exchange(1);
{
MutexLock lock(m_pushBlockLock);
uv_cond_broadcast(&m_pushBlockCond);
}
for (PushBlockThreadData* data : m_pushBlockThreads) {
uv_thread_join(&data->m_worker);
delete data;
}
m_pushBlockThreads.clear();
}
m_server->shutdown_tcp();
delete m_server;
@@ -112,22 +172,216 @@ MergeMiningClientTari::~MergeMiningClientTari()
uv_mutex_destroy(&m_workerLock);
uv_cond_destroy(&m_workerCond);
uv_mutex_destroy(&m_pushBlockLock);
uv_cond_destroy(&m_pushBlockCond);
LOGINFO(1, "stopped");
}
bool MergeMiningClientTari::get_params(ChainParameters& out_params) const
{
const uint64_t t = seconds_since_epoch();
ReadLock lock(m_chainParamsLock);
if (m_chainParams.aux_id.empty() || m_chainParams.aux_diff.empty()) {
return false;
}
if (t >= m_chainParams.last_updated + ChainParameters::EXPIRE_TIME) {
LOGWARN(4, m_hostStr << " merge mining data is outdated (" << (t - m_chainParams.last_updated) << " seconds old)");
return false;
}
out_params = m_chainParams;
return true;
}
void MergeMiningClientTari::submit_solution(const BlockTemplate* block_tpl, const uint8_t (&hashing_blob)[128], size_t nonce_offset, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path)
void MergeMiningClientTari::on_external_block(const PoolBlock& block)
{
#ifdef WITH_MERGE_MINING_DONATION
// The rest of the code is needed only when this node is sending donation messages
if (m_pool->params().m_authorKeyFile.empty()) {
return;
}
// Sanity check
if (block.m_transactions.empty() || block.m_hashingBlob.empty() || (block.m_hashingBlob.size() > 128)) {
LOGWARN(3, "on_external_block: sanity check failed - " << block.m_transactions.size() << " transactions, hashing blob size = " << block.m_hashingBlob.size());
return;
}
ChainParameters chain_params;
uint64_t previous_aux_hashes[NUM_PREVIOUS_HASHES];
{
ReadLock lock(m_chainParamsLock);
chain_params = m_chainParams;
memcpy(previous_aux_hashes, m_previousAuxHashes, sizeof(m_previousAuxHashes));
}
// Don't continue if our aux chain is not there
if (block.m_mergeMiningExtra.find(chain_params.aux_id) == block.m_mergeMiningExtra.end()) {
return;
}
std::vector<hash> aux_ids;
std::vector<AuxChainData> aux_chains;
// All aux chains in this block + the P2Pool sidechain
aux_ids.reserve(block.m_mergeMiningExtra.size() + 1);
// All aux chains in this block
aux_chains.reserve(block.m_mergeMiningExtra.size());
for (const auto& i : block.m_mergeMiningExtra) {
const std::vector<uint8_t>& v = i.second;
const uint8_t* p = v.data();
const uint8_t* e = v.data() + v.size();
if (p + HASH_SIZE > e) {
LOGWARN(3, "on_external_block: sanity check failed - invalid merge mining extra data " << '1');
return;
}
hash data;
memcpy(data.h, p, HASH_SIZE);
p += HASH_SIZE;
difficulty_type diff;
p = readVarint(p, e, diff.lo);
if (!p) {
LOGWARN(3, "on_external_block: sanity check failed - invalid merge mining extra data " << '2');
return;
}
p = readVarint(p, e, diff.hi);
if (!p) {
LOGWARN(3, "on_external_block: sanity check failed - invalid merge mining extra data " << '3');
return;
}
// If it's our aux chain, check that it's the same job and that there is enough PoW
if (i.first == chain_params.aux_id) {
if ((data != chain_params.aux_hash) || (diff != chain_params.aux_diff)) {
const uint64_t* a = previous_aux_hashes;
const uint64_t* b = previous_aux_hashes + NUM_PREVIOUS_HASHES;
if (std::find(a, b, *data.u64()) == b) {
LOGINFO(4, "External aux job solution found, but it's for another miner");
return;
}
else {
LOGINFO(4, "External aux job solution found, but it's stale");
}
}
if (!diff.check_pow(block.m_powHash)) {
LOGINFO(4, "External aux job solution found, but it doesn't have enough PoW (block diff = " << block.m_difficulty << ", Tari diff = " << diff << ')');
return;
}
}
aux_ids.emplace_back(i.first);
aux_chains.emplace_back(i.first, data, diff);
}
aux_ids.emplace_back(m_pool->side_chain().consensus_hash());
LOGINFO(0, log::LightGreen() << "External aux job solution found. Processing it!");
// coinbase_merkle_proof
std::vector<std::vector<hash>> tree;
merkle_hash_full_tree(block.m_transactions, tree);
std::vector<hash> proof;
uint32_t path;
if (!get_merkle_proof(tree, block.m_transactions[0], proof, path)) {
LOGWARN(3, "on_external_block: get_merkle_proof failed for coinbase transaction");
return;
}
std::vector<uint8_t> coinbase_merkle_proof;
for (const hash& h : proof) {
coinbase_merkle_proof.insert(coinbase_merkle_proof.end(), h.h, h.h + HASH_SIZE);
}
// hashing_blob
uint8_t hashing_blob[128] = {};
memcpy(hashing_blob, block.m_hashingBlob.data(), block.m_hashingBlob.size());
// nonce_offset and blob
size_t header_size = 0;
const std::vector<uint8_t> blob = block.serialize_mainchain_data(&header_size);
if (header_size <= NONCE_SIZE) {
LOGWARN(3, "on_external_block: invalid header_size");
return;
}
const uint32_t nonce_offset = static_cast<uint32_t>(header_size - NONCE_SIZE);
// aux_merkle_proof, aux_merkle_proof_path
std::vector<hash> aux_merkle_proof;
uint32_t aux_merkle_proof_path = 0;
const hash sidechain_id = block.m_sidechainId;
const uint32_t n_aux_chains = static_cast<uint32_t>(block.m_mergeMiningExtra.size() + 1);
std::vector<hash> hashes(n_aux_chains);
uint32_t aux_nonce;
if (!find_aux_nonce(aux_ids, aux_nonce, 1000)) {
LOGWARN(3, "on_external_block: failed to find aux_nonce");
return;
}
for (const AuxChainData& aux_data : aux_chains) {
const uint32_t aux_slot = get_aux_slot(aux_data.unique_id, aux_nonce, n_aux_chains);
if (!hashes[aux_slot].empty()) {
LOGWARN(3, "on_external_block: found an incorrect aux_nonce " << '1');
return;
}
hashes[aux_slot] = aux_data.data;
}
const uint32_t aux_slot = get_aux_slot(m_pool->side_chain().consensus_hash(), aux_nonce, n_aux_chains);
if (!hashes[aux_slot].empty()) {
LOGWARN(3, "on_external_block: found an incorrect aux_nonce " << '2');
return;
}
hashes[aux_slot] = sidechain_id;
merkle_hash_full_tree(hashes, tree);
if (tree.empty() || tree.back().empty() || (tree.back().front() != block.m_merkleRoot)) {
LOGWARN(3, "on_external_block: merkle root didn't match");
return;
}
if (!get_merkle_proof(tree, chain_params.aux_hash, aux_merkle_proof, aux_merkle_proof_path)) {
LOGWARN(3, "on_external_block: get_merkle_proof failed for the aux hash");
return;
}
submit_solution(coinbase_merkle_proof, hashing_blob, nonce_offset, block.m_seed, blob, aux_merkle_proof, aux_merkle_proof_path);
#else // WITH_MERGE_MINING_DONATION
(void) block;
#endif // WITH_MERGE_MINING_DONATION
}
void MergeMiningClientTari::submit_solution(const std::vector<uint8_t>& coinbase_merkle_proof, const uint8_t (&hashing_blob)[128], size_t nonce_offset, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path)
{
Block block;
{
@@ -136,7 +390,7 @@ void MergeMiningClientTari::submit_solution(const BlockTemplate* block_tpl, cons
}
ProofOfWork* pow = block.mutable_header()->mutable_pow();
pow->set_pow_algo(PowAlgo_PowAlgos_POW_ALGOS_RANDOMX);
pow->set_pow_algo(PowAlgo_PowAlgos_POW_ALGOS_RANDOMXM);
{
std::string data;
@@ -164,8 +418,6 @@ void MergeMiningClientTari::submit_solution(const BlockTemplate* block_tpl, cons
data.append(reinterpret_cast<const char*>(hashing_blob + nonce_offset + sizeof(uint32_t)), HASH_SIZE);
// Coinbase transaction's Merkle proof
const std::vector<uint8_t> coinbase_merkle_proof = block_tpl->get_coinbase_merkle_proof();
// Number of hashes in the proof (varint, but an O(logN) proof will never get bigger than 127)
data.append(1, static_cast<char>(coinbase_merkle_proof.size() / HASH_SIZE));
@@ -242,12 +494,56 @@ void MergeMiningClientTari::submit_solution(const BlockTemplate* block_tpl, cons
pow->set_pow_data(data);
}
{
const std::string& h = block.header().hash();
LOGINFO(4, "Block " << log::hex_buf(h.data(), h.size()) << ": PoW data is set, everything is ready. Submitting it!");
}
if (!m_pushBlockThreads.empty()) {
MutexLock lock(m_pushBlockLock);
m_blockToPush = block;
uv_cond_broadcast(&m_pushBlockCond);
}
struct Work
{
uv_work_t req;
MergeMiningClientTari* client;
Block block;
} *work = new Work{ {}, this, std::move(block) };
FORCEINLINE Work(MergeMiningClientTari* c, Block&& b) : req{}, client(c), block(std::move(b)) {}
void process() const
{
grpc::ClientContext ctx;
SubmitBlockResponse response;
const grpc::Status status = client->m_TariNode->SubmitBlock(&ctx, block, &response);
if (!status.ok()) {
LOGWARN(4, "SubmitBlock failed: " << status.error_message());
if (!status.error_details().empty()) {
LOGWARN(4, "SubmitBlock failed: " << status.error_details());
}
}
else {
const std::string& h = response.block_hash();
LOGINFO(0, log::LightGreen() << "Mined Tari block " << log::hex_buf(h.data(), h.size()) << " at height " << block.header().height());
}
// We've just submitted a new block. Signal the polling thread to stop waiting and get a new block template.
MutexLock lock(client->m_workerLock);
uv_cond_signal(&client->m_workerCond);
}
} *work = new Work(this, std::move(block));
if (!is_main_thread()) {
LOGINFO(5, "Running SubmitBlock in the current thread because uv_default_loop can only be used in the main thread");
work->process();
delete work;
return;
}
work->req.data = work;
@@ -255,23 +551,7 @@ void MergeMiningClientTari::submit_solution(const BlockTemplate* block_tpl, cons
[](uv_work_t* req)
{
BACKGROUND_JOB_START(MergeMiningClientTari::submit_solution);
grpc::ClientContext ctx;
SubmitBlockResponse response;
const Work* w = reinterpret_cast<Work*>(req->data);
const grpc::Status status = w->client->m_TariNode->SubmitBlock(&ctx, w->block, &response);
if (!status.ok()) {
LOGWARN(5, "SubmitBlock failed: " << status.error_message());
if (!status.error_details().empty()) {
LOGWARN(5, "SubmitBlock failed: " << status.error_details());
}
}
else {
const std::string& h = response.block_hash();
LOGINFO(0, log::LightGreen() << "Mined Tari block " << log::hex_buf(h.data(), h.size()) << " at height " << w->block.header().height());
}
reinterpret_cast<Work*>(req->data)->process();
},
[](uv_work_t* req, int /*status*/)
{
@@ -324,6 +604,23 @@ void MergeMiningClientTari::print_status() const
);
}
void MergeMiningClientTari::api_status(log::Stream& s) const
{
ReadLock lock(m_chainParamsLock);
s << '{'
<< "\"api\":\"Tari gRPC\","
<< "\"id\":\"" << m_chainParams.aux_id << "\","
<< "\"host\":\"" << m_hostStr << "\","
<< "\"wallet\":\"" << m_auxWallet << "\","
<< "\"height\":" << m_tariJobParams.height << ","
<< "\"difficulty\":" << m_tariJobParams.diff << ","
<< "\"reward\":" << m_tariJobParams.reward << ","
<< "\"fees\":" << m_tariJobParams.fees << ","
<< "\"timestamp\":" << m_chainParamsTimestamp
<< '}';
}
void MergeMiningClientTari::run_wrapper(void* arg)
{
reinterpret_cast<MergeMiningClientTari*>(arg)->run();
@@ -334,103 +631,152 @@ void MergeMiningClientTari::run()
{
LOGINFO(1, "worker thread ready");
set_thread_name("MM Tari poll");
using namespace std::chrono;
for (;;) {
const auto t1 = high_resolution_clock::now();
TipInfoResponse prev_tip_info{};
auto prev_tip_info_update_time = high_resolution_clock::now();
auto same_tip = [](const TipInfoResponse& a, const TipInfoResponse& b) -> bool {
return
(a.metadata().best_block_height() == b.metadata().best_block_height()) &&
(a.metadata().best_block_hash() == b.metadata().best_block_hash()) &&
(a.metadata().accumulated_difficulty() == b.metadata().accumulated_difficulty()) &&
(a.initial_sync_achieved() == b.initial_sync_achieved()) &&
(a.base_node_state() == b.base_node_state()) &&
(a.failed_checkpoints() == b.failed_checkpoints());
};
while (!m_workerStop) {
const auto start_time = high_resolution_clock::now();
// Force frequent enough updates (at least every 30 seconds)
if (duration_cast<seconds>(start_time - prev_tip_info_update_time).count() >= 30) {
prev_tip_info.mutable_metadata()->set_best_block_height(0);
}
MutexLock lock(m_workerLock);
GetNewBlockTemplateWithCoinbasesRequest request;
PowAlgo* algo = new PowAlgo();
algo->set_pow_algo(PowAlgo_PowAlgos_POW_ALGOS_RANDOMX);
request.clear_algo();
request.set_allocated_algo(algo);
request.set_max_weight(0);
grpc::ClientContext get_tip_info_ctx{};
Empty get_tip_info_request{};
TipInfoResponse cur_tip_info{};
NewBlockCoinbase* coinbase = request.add_coinbases();
coinbase->set_address(m_auxWallet);
const grpc::Status get_tip_info_status = m_TariNode->GetTipInfo(&get_tip_info_ctx, get_tip_info_request, &cur_tip_info);
// TODO this should be equal to the total weight of shares in the PPLNS window for each wallet
coinbase->set_value(1);
coinbase->set_stealth_payment(false);
coinbase->set_revealed_value_proof(true);
coinbase->clear_coinbase_extra();
grpc::ClientContext ctx;
GetNewBlockResult response;
const grpc::Status status = m_TariNode->GetNewBlockTemplateWithCoinbases(&ctx, request, &response);
if (!status.ok()) {
LOGWARN(5, "GetNewBlockTemplateWithCoinbases failed: " << status.error_message());
if (!status.error_details().empty()) {
LOGWARN(5, "GetNewBlockTemplateWithCoinbases failed: " << status.error_details());
if (!get_tip_info_status.ok()) {
LOGWARN(4, "GetTipInfo failed: " << get_tip_info_status.error_message());
if (!get_tip_info_status.error_details().empty()) {
LOGWARN(4, "GetTipInfo failed: " << get_tip_info_status.error_details());
}
}
else {
const std::string& id = response.tari_unique_id();
const std::string& mm_hash = response.merge_mining_hash();
else if (!same_tip(cur_tip_info, prev_tip_info)) {
GetNewBlockTemplateWithCoinbasesRequest request{};
bool ok = true;
PowAlgo* algo = new PowAlgo();
algo->set_pow_algo(PowAlgo_PowAlgos_POW_ALGOS_RANDOMXM);
if (id.size() != HASH_SIZE) {
LOGERR(1, "Tari unique_id has invalid size (" << id.size() << ')');
ok = false;
request.clear_algo();
request.set_allocated_algo(algo);
request.set_max_weight(0);
NewBlockCoinbase* coinbase = request.add_coinbases();
coinbase->set_address(m_auxWallet);
// TODO this should be equal to the total weight of shares in the PPLNS window for each wallet
coinbase->set_value(1);
coinbase->set_stealth_payment(false);
coinbase->set_revealed_value_proof(true);
coinbase->clear_coinbase_extra();
grpc::ClientContext ctx{};
GetNewBlockResult response{};
const grpc::Status status = m_TariNode->GetNewBlockTemplateWithCoinbases(&ctx, request, &response);
if (!status.ok()) {
LOGWARN(4, "GetNewBlockTemplateWithCoinbases failed: " << status.error_message());
if (!status.error_details().empty()) {
LOGWARN(4, "GetNewBlockTemplateWithCoinbases failed: " << status.error_details());
}
}
else {
prev_tip_info = cur_tip_info;
prev_tip_info_update_time = start_time;
if (mm_hash.size() != HASH_SIZE) {
LOGERR(1, "Tari merge mining hash has invalid size (" << mm_hash.size() << ')');
ok = false;
}
const std::string& id = response.tari_unique_id();
const std::string& mm_hash = response.merge_mining_hash();
if (ok) {
TariJobParams job_params;
bool ok = true;
job_params.height = response.block().header().height();
job_params.diff = response.miner_data().target_difficulty();
job_params.reward = response.miner_data().reward();
job_params.fees = response.miner_data().total_fees();
if (id.size() != HASH_SIZE) {
LOGERR(1, "Tari unique_id has invalid size (" << id.size() << ')');
ok = false;
}
hash chain_id;
{
WriteLock lock2(m_chainParamsLock);
if (mm_hash.size() != HASH_SIZE) {
LOGERR(1, "Tari merge mining hash has invalid size (" << mm_hash.size() << ')');
ok = false;
}
if (job_params != m_tariJobParams) {
m_tariJobParams = job_params;
if (ok) {
TariJobParams job_params;
if (m_chainParams.aux_id.empty()) {
LOGINFO(1, m_hostStr << " uses chain_id " << log::LightCyan() << log::hex_buf(id.data(), id.size()));
std::copy(id.begin(), id.end(), m_chainParams.aux_id.h);
job_params.height = response.block().header().height();
job_params.diff = response.miner_data().target_difficulty();
job_params.reward = response.miner_data().reward();
job_params.fees = response.miner_data().total_fees();
hash chain_id;
do {
WriteLock lock2(m_chainParamsLock);
if (job_params != m_tariJobParams) {
m_tariJobParams = job_params;
if (m_chainParams.aux_id.empty()) {
LOGINFO(1, m_hostStr << " uses chain_id " << log::LightCyan() << log::hex_buf(id.data(), id.size()));
std::copy(id.begin(), id.end(), m_chainParams.aux_id.h);
}
chain_id = m_chainParams.aux_id;
m_previousAuxHashes[(m_previousAuxHashesIndex++) % NUM_PREVIOUS_HASHES] = *m_chainParams.aux_hash.u64();
std::copy(mm_hash.begin(), mm_hash.end(), m_chainParams.aux_hash.h);
m_chainParams.aux_diff = static_cast<difficulty_type>(response.miner_data().target_difficulty());
m_chainParams.last_updated = seconds_since_epoch();
m_chainParamsTimestamp = time(nullptr);
m_tariBlock = std::move(*response.mutable_block());
LOGINFO(4, "Tari aux block template: height = " << job_params.height
<< ", diff = " << job_params.diff
<< ", reward = " << job_params.reward
<< ", fees = " << job_params.fees
<< ", hash = " << log::hex_buf(mm_hash.data(), mm_hash.size())
);
}
} while (0);
chain_id = m_chainParams.aux_id;
std::copy(mm_hash.begin(), mm_hash.end(), m_chainParams.aux_hash.h);
m_chainParams.aux_diff = static_cast<difficulty_type>(response.miner_data().target_difficulty());
m_tariBlock = response.block();
LOGINFO(5, "Tari block template: height = " << job_params.height
<< ", diff = " << job_params.diff
<< ", reward = " << job_params.reward
<< ", fees = " << job_params.fees
<< ", hash = " << log::hex_buf(mm_hash.data(), mm_hash.size())
);
if (!chain_id.empty()) {
m_pool->update_aux_data(chain_id);
}
}
if (!chain_id.empty()) {
m_pool->update_aux_data(chain_id);
}
}
}
const int64_t timeout = std::max<int64_t>(500'000'000 - duration_cast<nanoseconds>(high_resolution_clock::now() - t1).count(), 1'000'000);
auto dt = duration_cast<nanoseconds>(high_resolution_clock::now() - start_time).count();
if ((m_workerStop.load() != 0) || (uv_cond_timedwait(&m_workerCond, &m_workerLock, timeout) != UV_ETIMEDOUT)) {
return;
LOGINFO(6, "Polling loop took " << (static_cast<double>(dt) * 1e-6) << " ms");
const int64_t timeout = std::max<int64_t>(500'000'000 - dt, 1'000'000);
if (!m_workerStop) {
uv_cond_timedwait(&m_workerCond, &m_workerLock, timeout);
}
}
}
@@ -451,9 +797,10 @@ MergeMiningClientTari::TariServer::TariServer(const std::string& socks5Proxy)
bool MergeMiningClientTari::TariServer::start()
{
std::random_device rd;
std::mt19937_64 rng(rd());
for (size_t i = 0; i < 10; ++i) {
if (start_listening(false, "127.0.0.1", 49152 + (rd() % 16384))) {
if (start_listening(false, "127.0.0.1", 49152 + (rng() % 16384))) {
break;
}
}
@@ -599,4 +946,78 @@ bool MergeMiningClientTari::TariClient::on_read(const char* data, uint32_t size)
});
}
void MergeMiningClientTari::push_block_thread(void* arg)
{
set_thread_name("Push Tari block");
PushBlockThreadData* data = reinterpret_cast<PushBlockThreadData*>(arg);
LOGINFO(1, "push block thread ready for " << data->m_node);
try {
data->m_client->push_blocks_to(data->m_node);
}
catch (const std::exception& e) {
LOGERR(0, "Exception in push_blocks_to(" << data->m_node << "): " << e.what());
}
LOGINFO(1, "push block thread stopped for " << data->m_node);
}
void MergeMiningClientTari::push_blocks_to(const std::string& node_address)
{
using namespace tari::rpc;
std::unique_ptr<BaseNode::Stub> node(new BaseNode::Stub(grpc::CreateCustomChannel(node_address, grpc::InsecureChannelCredentials(), m_channelArgs)));
grpc::ClientContext get_tip_info_ctx{};
Empty get_tip_info_request{};
TipInfoResponse tip_info{};
const grpc::Status get_tip_info_status = node->GetTipInfo(&get_tip_info_ctx, get_tip_info_request, &tip_info);
if (!get_tip_info_status.ok()) {
LOGWARN(4, "GetTipInfo failed for " << node_address << ": " << get_tip_info_status.error_message());
if (!get_tip_info_status.error_details().empty()) {
LOGWARN(4, "GetTipInfo failed for " << node_address << ": " << get_tip_info_status.error_details());
}
}
else {
LOGINFO(4, node_address << " is at block height " << tip_info.metadata().best_block_height());
}
while (!m_pushBlockStop) {
Block block;
{
MutexLock lock(m_pushBlockLock);
uv_cond_wait(&m_pushBlockCond, &m_pushBlockLock);
if (m_pushBlockStop) {
return;
}
block = m_blockToPush;
}
const std::string& h = block.header().hash();
LOGINFO(4, "Pushing block " << log::hex_buf(h.data(), h.size()) << " to " << node_address);
grpc::ClientContext ctx;
SubmitBlockResponse response;
const grpc::Status status = node->SubmitBlock(&ctx, block, &response);
if (!status.ok()) {
LOGWARN(4, "SubmitBlock failed for " << node_address << ": " << status.error_message());
if (!status.error_details().empty()) {
LOGWARN(4, "SubmitBlock failed for " << node_address << ": " << status.error_details());
}
}
else {
const std::string& h1 = response.block_hash();
LOGINFO(0, log::LightGreen() << "Pushed Tari block " << log::hex_buf(h1.data(), h1.size()) << " to " << node_address);
}
}
}
} // namespace p2pool
+34 -2
View File
@@ -23,6 +23,7 @@
namespace p2pool {
class p2pool;
struct PoolBlock;
class MergeMiningClientTari : public IMergeMiningClient, public nocopy_nomove
{
@@ -33,13 +34,25 @@ public:
static constexpr char TARI_PREFIX[] = "tari://";
bool get_params(ChainParameters& out_params) const override;
void submit_solution(const BlockTemplate* block_tpl, const uint8_t (&hashing_blob)[128], size_t nonce_offset, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path) override;
void on_external_block(const PoolBlock& block) override;
void submit_solution(const std::vector<uint8_t>& coinbase_merkle_proof, const uint8_t (&hashing_blob)[128], size_t nonce_offset, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path) override;
void print_status() const override;
void api_status(log::Stream&) const override;
private:
mutable uv_rwlock_t m_chainParamsLock;
ChainParameters m_chainParams;
uint64_t m_chainParamsTimestamp;
enum {
NUM_PREVIOUS_HASHES = 8,
};
uint64_t m_previousAuxHashes[NUM_PREVIOUS_HASHES];
uint32_t m_previousAuxHashesIndex;
tari::rpc::Block m_tariBlock;
std::string m_auxWallet;
@@ -86,6 +99,7 @@ private:
const std::string m_hostStr;
grpc::ChannelArguments m_channelArgs;
tari::rpc::BaseNode::Stub* m_TariNode;
struct TariClient : public TCPServer::Client
@@ -100,7 +114,7 @@ private:
[[nodiscard]] bool on_connect() override;
[[nodiscard]] bool on_read(const char* data, uint32_t size) override;
char m_buf[BUF_SIZE];
alignas(8) char m_buf[BUF_SIZE];
std::vector<uint8_t> m_pendingData;
bool is_paired() const { return m_pairedClient && (m_pairedClient->m_resetCounter == m_pairedClientSavedResetCounter); }
@@ -117,6 +131,24 @@ private:
static void run_wrapper(void* arg);
void run();
uv_mutex_t m_pushBlockLock;
uv_cond_t m_pushBlockCond;
std::atomic<uint32_t> m_pushBlockStop;
tari::rpc::Block m_blockToPush;
struct PushBlockThreadData
{
uv_thread_t m_worker;
MergeMiningClientTari* m_client;
std::string m_node;
};
std::vector<PushBlockThreadData*> m_pushBlockThreads;
static void push_block_thread(void* arg);
void push_blocks_to(const std::string& node_address);
};
} // namespace p2pool
+8
View File
@@ -152,8 +152,16 @@ void Miner::run(void* data)
{
WorkerData* d = static_cast<WorkerData*>(data);
LOGINFO(1, "worker thread " << d->m_index << '/' << d->m_count << " started");
char buf[16] = {};
log::Stream s(buf);
s << "Miner " << d->m_index << '/' << d->m_count;
set_thread_name(buf);
make_thread_background();
d->m_miner->run(d);
LOGINFO(1, "worker thread " << d->m_index << '/' << d->m_count << " stopped");
}
+310 -2
View File
@@ -29,6 +29,16 @@
#include "p2pool_api.h"
#include "stratum_server.h"
#include "rapidjson_wrapper.h"
#include "merge_mining_client.h"
#include "sha256.h"
#ifdef WITH_TLS
#include <openssl/curve25519.h>
#else
#define ED25519_PUBLIC_KEY_LEN 32
#define ED25519_SIGNATURE_LEN 64
#endif
#include <fstream>
#include <numeric>
@@ -37,6 +47,7 @@ LOG_CATEGORY(P2PServer)
static constexpr char saved_peer_list_file_name[] = "p2pool_peers.txt";
static const char* seed_nodes[] = { "seeds.p2pool.io", "main.p2poolpeers.net", "main.gupax.io", "" };
static const char* seed_nodes_mini[] = { "seeds-mini.p2pool.io", "mini.p2poolpeers.net", "mini.gupax.io", "" };
static const char* seed_nodes_nano[] = { "seeds-nano.p2pool.io", "nano.p2poolpeers.net", "nano.gupax.io", ""};
static constexpr int DEFAULT_BACKLOG = 16;
static constexpr uint64_t DEFAULT_BAN_TIME = 600;
@@ -62,10 +73,13 @@ P2PServer::P2PServer(p2pool* pool)
, m_lookForMissingBlocks(true)
, m_fastestPeer(nullptr)
, m_newP2PoolVersionDetected(false)
, m_auxJobLastMessageTimestamp(0)
{
m_callbackBuf.resize(P2P_BUF_SIZE);
m_blockDeserializeBuf.reserve(MAX_BLOCK_SIZE);
m_auxJobMessages.reserve(1024);
// Diffuse the initial state in case it has low quality
m_rng.discard(10000);
@@ -105,6 +119,17 @@ P2PServer::P2PServer(p2pool* pool)
}
m_showPeersAsync.data = this;
#ifdef WITH_MERGE_MINING_DONATION
uv_mutex_init_checked(&m_AuxJobBroadcastLock);
err = uv_async_init(&m_loop, &m_AuxJobBroadcastAsync, on_aux_job_broadcast);
if (err) {
LOGERR(1, "uv_async_init failed, error " << uv_err_name(err));
PANIC_STOP();
}
m_AuxJobBroadcastAsync.data = this;
#endif
err = uv_timer_init(&m_loop, &m_timer);
if (err) {
LOGERR(1, "failed to create timer, error " << uv_err_name(err));
@@ -142,6 +167,10 @@ P2PServer::~P2PServer()
uv_mutex_destroy(&m_connectToPeersLock);
uv_mutex_destroy(&m_showPeersLock);
#ifdef WITH_MERGE_MINING_DONATION
uv_mutex_destroy(&m_AuxJobBroadcastLock);
#endif
delete m_block;
delete m_cache;
@@ -578,6 +607,9 @@ void P2PServer::load_peer_list()
else if (m_pool->side_chain().is_mini()) {
load_from_seed_nodes(seed_nodes_mini, DEFAULT_P2P_PORT_MINI);
}
else if (m_pool->side_chain().is_nano()) {
load_from_seed_nodes(seed_nodes_nano, DEFAULT_P2P_PORT_NANO);
}
}
// Finally load peers from p2pool_peers.txt
@@ -670,7 +702,7 @@ void P2PServer::load_monerod_peer_list()
#undef ERR_STR
const int port = m_pool->side_chain().is_mini() ? DEFAULT_P2P_PORT_MINI : DEFAULT_P2P_PORT;
const int port = m_pool->side_chain().is_mini() ? DEFAULT_P2P_PORT_MINI : (m_pool->side_chain().is_nano() ? DEFAULT_P2P_PORT_NANO : DEFAULT_P2P_PORT);
const SizeType n = white_list.Size();
@@ -1008,7 +1040,7 @@ void P2PServer::on_broadcast()
return p - buf;
});
if (!result) {
LOGWARN(5, "failed to broadcast to " << static_cast<char*>(client->m_addrString) << ", disconnecting");
LOGWARN(5, "failed to broadcast a block to " << static_cast<char*>(client->m_addrString) << ", disconnecting");
client->close();
break;
}
@@ -1061,6 +1093,15 @@ void P2PServer::show_peers() const
if (client->m_SoftwareVersion) {
log::Stream s(buf);
s << P2PClient::SoftwareDisplayName(client->m_SoftwareID, client->m_SoftwareVersion);
// Show protocol version in peer list
switch (client->m_protocolVersion) {
case PROTOCOL_VERSION_1_0: s << " p1.0"; break;
case PROTOCOL_VERSION_1_1: s << " p1.1"; break;
case PROTOCOL_VERSION_1_2: s << " p1.2"; break;
case PROTOCOL_VERSION_1_3: s << " p1.3"; break;
default: s << " p?"; break;
}
}
LOGINFO(0, (client->m_isIncoming ? "I\t" : "O\t")
<< log::pad_right(log::Duration(cur_time - client->m_connectedTime), 16) << '\t'
@@ -1132,6 +1173,7 @@ void P2PServer::on_timer()
check_block_template();
check_for_updates();
api_update_local_stats();
clean_aux_job_messages();
}
void P2PServer::flush_cache()
@@ -1374,6 +1416,13 @@ void P2PServer::on_shutdown()
MutexLock lock(m_showPeersLock);
uv_close(reinterpret_cast<uv_handle_t*>(&m_showPeersAsync), nullptr);
}
#ifdef WITH_MERGE_MINING_DONATION
{
MutexLock lock(m_AuxJobBroadcastLock);
uv_close(reinterpret_cast<uv_handle_t*>(&m_AuxJobBroadcastAsync), nullptr);
}
#endif
}
void P2PServer::api_update_local_stats()
@@ -1429,6 +1478,112 @@ void P2PServer::api_update_local_stats()
});
}
#ifdef WITH_MERGE_MINING_DONATION
void P2PServer::broadcast_aux_job_donation_async(const uint8_t* data, uint32_t data_size, uint64_t timestamp)
{
MutexLock lock(m_AuxJobBroadcastLock);
m_AuxJobBroadcast.job.assign(data, data + data_size);
m_AuxJobBroadcast.timestamp = timestamp;
const int err = uv_async_send(&m_AuxJobBroadcastAsync);
if (err) {
LOGERR(1, "uv_async_send failed, error " << uv_err_name(err));
}
}
void P2PServer::broadcast_aux_job_donation_handler()
{
AuxJobBroadcast auxJobBroadcast;
{
MutexLock lock(m_AuxJobBroadcastLock);
auxJobBroadcast = std::move(m_AuxJobBroadcast);
}
if (auxJobBroadcast.job.empty()) {
return;
}
broadcast_aux_job_donation(auxJobBroadcast.job.data(), static_cast<uint32_t>(auxJobBroadcast.job.size()), auxJobBroadcast.timestamp, nullptr, false);
}
#endif
void P2PServer::broadcast_aux_job_donation(const uint8_t* data, uint32_t data_size, uint64_t timestamp, const P2PClient* source, bool duplicate_check_done)
{
check_event_loop_thread(__func__);
if (!duplicate_check_done) {
hash digest;
sha256(data, data_size, digest.h);
// Every message can be received from multiple peers, so broadcast it only once
if (!m_auxJobMessages.emplace(*digest.u64(), timestamp).second) {
return;
}
}
m_auxJobLastMessage.assign(data, data + data_size);
m_auxJobLastMessageTimestamp = timestamp;
for (P2PClient* client = static_cast<P2PClient*>(m_connectedClientsList->m_next); client != m_connectedClientsList; client = static_cast<P2PClient*>(client->m_next)) {
if ((source && (client == source)) || !client->is_good() || (client->m_protocolVersion < PROTOCOL_VERSION_1_3)) {
continue;
}
send_aux_job_donation(client, data, data_size);
}
}
void P2PServer::send_aux_job_donation(P2PServer::P2PClient* client, const uint8_t* data, uint32_t data_size)
{
const bool result = send(client, [client, data, data_size](uint8_t* buf, size_t buf_size) -> size_t {
LOGINFO(6, "sending AUX_JOB_DONATION to " << static_cast<char*>(client->m_addrString));
if (buf_size < 1 + sizeof(uint32_t) + data_size) {
return 0;
}
uint8_t* p = buf;
*(p++) = static_cast<uint8_t>(MessageId::AUX_JOB_DONATION);
memcpy(p, &data_size, sizeof(uint32_t));
p += sizeof(uint32_t);
memcpy(p, data, data_size);
p += data_size;
return p - buf;
});
if (!result) {
LOGWARN(5, "failed to send AUX_JOB_DONATION to " << static_cast<char*>(client->m_addrString) << ", disconnecting");
client->close();
}
}
void P2PServer::clean_aux_job_messages()
{
if ((m_timerCounter & 255) != 0) {
return;
}
if (m_auxJobMessages.empty()) {
return;
}
const uint64_t cur_time = time(nullptr);
for (auto it = m_auxJobMessages.begin(); it != m_auxJobMessages.end();) {
// Delete old messages only after 3x the timeout to give some leeway for system clock adjustments
if (cur_time > it->second + AUX_JOB_TIMEOUT * 3) {
it = m_auxJobMessages.erase(it);
}
else {
++it;
}
}
}
P2PServer::P2PClient::~P2PClient()
{
}
@@ -1725,6 +1880,23 @@ bool P2PServer::P2PClient::on_read(const char* data, uint32_t size)
on_block_notify(buf + 1);
}
break;
case MessageId::AUX_JOB_DONATION:
LOGINFO(6, "peer " << log::Gray() << static_cast<char*>(m_addrString) << log::NoColor() << " sent AUX_JOB_DONATION");
if (bytes_left >= 1 + sizeof(uint32_t)) {
const uint32_t msg_size = read_unaligned(reinterpret_cast<uint32_t*>(buf + 1));
if (bytes_left >= 1 + sizeof(uint32_t) + msg_size) {
bytes_read = 1 + sizeof(uint32_t) + msg_size;
if (!on_aux_job_donation(buf + 1 + sizeof(uint32_t), msg_size)) {
ban(DEFAULT_BAN_TIME);
server->remove_peer_from_list(this);
return false;
}
}
}
break;
}
if (bytes_read) {
@@ -2432,6 +2604,13 @@ void P2PServer::P2PClient::on_peer_list_response(const uint8_t* buf)
<< "runs an unknown software with id = " << log::Hex(id_value)
);
}
// We know this peer's protocol version now. Send protocol-specific messages here.
if ((m_protocolVersion >= PROTOCOL_VERSION_1_3) && !server->m_auxJobLastMessage.empty()) {
if (static_cast<uint64_t>(time(nullptr)) < server->m_auxJobLastMessageTimestamp + AUX_JOB_TIMEOUT) {
server->send_aux_job_donation(this, server->m_auxJobLastMessage.data(), static_cast<uint32_t>(server->m_auxJobLastMessage.size()));
}
}
}
continue;
}
@@ -2510,6 +2689,135 @@ void P2PServer::P2PClient::on_block_notify(const uint8_t* buf)
}
}
bool P2PServer::P2PClient::on_aux_job_donation(const uint8_t* buf, uint32_t size)
{
P2PServer* server = static_cast<P2PServer*>(m_owner);
// Ignore the same message coming from other peers
if ((server->m_auxJobLastMessage.size() == size) && (memcmp(server->m_auxJobLastMessage.data(), buf, size) == 0)) {
return true;
}
const time_t cur_time = time(nullptr);
// Layout of the message:
//
// 32 bytes | Secondary public key
// 8 bytes | Secondary public key's expiration timestamp
// 64 bytes | Master key signature signing the above 40 bytes
// (size - 168) bytes | Data
// 64 bytes | Secondary key signature signing the data
constexpr uint32_t DATA_OFFSET = ED25519_PUBLIC_KEY_LEN + 8 + ED25519_SIGNATURE_LEN;
constexpr uint32_t OVERHEAD = DATA_OFFSET + ED25519_SIGNATURE_LEN;
constexpr uint32_t DATA_ENTRY_SIZE = HASH_SIZE * 2 + sizeof(difficulty_type);
constexpr uint32_t MIN_DATA_SIZE = sizeof(uint64_t) + DATA_ENTRY_SIZE;
// Ignore invalid or empty messages
if (size < OVERHEAD + MIN_DATA_SIZE) {
LOGWARN(4, "peer " << static_cast<char*>(m_addrString) << " sent an invalid AUX_JOB_DONATION message (" << size << " < " << (OVERHEAD + MIN_DATA_SIZE) << ')');
return false;
}
// Layout of the data:
//
// 8 bytes | timestamp
//
// Next come one or multiple data entries:
//
// 32 bytes | aux_id
// 32 bytes | aux_hash
// 16 bytes | aux_diff
const uint32_t data_size = size - OVERHEAD;
const int64_t secondary_key_expiration_time = read_unaligned(reinterpret_cast<const int64_t*>(buf + ED25519_PUBLIC_KEY_LEN));
// Ignore messages signed with an outdated secondary key
if (cur_time >= secondary_key_expiration_time) {
LOGWARN(4, "peer " << static_cast<char*>(m_addrString) << " sent an AUX_JOB_DONATION message with an expired secondary key (" << cur_time << " >= " << secondary_key_expiration_time << ")");
return true;
}
// Check secondary public key's signature
uint8_t signature[ED25519_SIGNATURE_LEN];
memcpy(signature, buf + ED25519_PUBLIC_KEY_LEN + 8, sizeof(signature));
// Ignore messages with invalid signatures
#ifdef WITH_TLS // Need BoringSSL to verify signatures
if (!ED25519_verify(buf, ED25519_PUBLIC_KEY_LEN + 8, signature, ED25519_MASTER_PUBLIC_KEY)) {
LOGWARN(4, "peer " << static_cast<char*>(m_addrString) << " sent an AUX_JOB_DONATION message with an invalid master key signature");
return true;
}
#endif
const uint8_t* p = buf + DATA_OFFSET;
const uint8_t* data_end = p + data_size;
memcpy(signature, data_end, sizeof(signature));
uint8_t secondary_public_key[ED25519_PUBLIC_KEY_LEN];
memcpy(secondary_public_key, buf, sizeof(secondary_public_key));
// Ignore messages with invalid signatures
#ifdef WITH_TLS // Need BoringSSL to verify signatures
if (!ED25519_verify(p, data_size, signature, secondary_public_key)) {
LOGWARN(4, "peer " << static_cast<char*>(m_addrString) << " sent an AUX_JOB_DONATION message with an invalid secondary key signature");
return true;
}
#endif
const int64_t data_timestamp = read_unaligned(reinterpret_cast<const int64_t*>(p));
p += sizeof(int64_t);
// Ignore outdated messages
if (cur_time >= data_timestamp + AUX_JOB_TIMEOUT) {
LOGWARN(4, "peer " << static_cast<char*>(m_addrString) << " sent an outdated AUX_JOB_DONATION message (" << cur_time << " >= " << data_timestamp << " + " << static_cast<int>(AUX_JOB_TIMEOUT) << ')');
return true;
}
if ((data_end - p) % DATA_ENTRY_SIZE) {
LOGWARN(4, "peer " << static_cast<char*>(m_addrString) << " sent an invalid AUX_JOB_DONATION message (" << (data_end - p) << " is not a multiple of " << DATA_ENTRY_SIZE << ')');
return true;
}
hash digest;
sha256(buf, size, digest.h);
// Ignore repeated old messages
if (!server->m_auxJobMessages.emplace(*digest.u64(), data_timestamp).second) {
LOGWARN(5, "peer " << static_cast<char*>(m_addrString) << " sent an old AUX_JOB_DONATION message (" << (cur_time - data_timestamp) << " seconds old)");
return true;
}
#if defined(WITH_MERGE_MINING_DONATION) && defined(WITH_TLS) // Only work on verified jobs
const uint32_t N = static_cast<uint32_t>(data_end - p) / DATA_ENTRY_SIZE;
std::vector<IMergeMiningClient::ChainParameters> chain_params_vec(N);
for (uint32_t i = 0; i < N; ++i) {
IMergeMiningClient::ChainParameters& chain_params = chain_params_vec[i];
memcpy(chain_params.aux_id.h, p, HASH_SIZE);
p += HASH_SIZE;
memcpy(chain_params.aux_hash.h, p, HASH_SIZE);
p += HASH_SIZE;
chain_params.aux_diff.lo = read_unaligned(reinterpret_cast<const uint64_t*>(p));
p += sizeof(uint64_t);
chain_params.aux_diff.hi = read_unaligned(reinterpret_cast<const uint64_t*>(p));
p += sizeof(uint64_t);
}
server->m_pool->set_aux_job_donation(chain_params_vec);
#endif
server->broadcast_aux_job_donation(buf, size, data_timestamp, this, true);
return true;
}
bool P2PServer::P2PClient::handle_incoming_block_async(const PoolBlock* block, uint64_t max_time_delta)
{
P2PServer* server = static_cast<P2PServer*>(m_owner);
+41 -2
View File
@@ -34,12 +34,14 @@ static_assert((P2P_BUF_SIZE & (P2P_BUF_SIZE - 1)) == 0, "P2P_BUF_SIZE is not a p
static constexpr size_t PEER_LIST_RESPONSE_MAX_PEERS = 16;
static constexpr int DEFAULT_P2P_PORT = 37889;
static constexpr int DEFAULT_P2P_PORT_MINI = 37888;
static constexpr int DEFAULT_P2P_PORT_NANO = 37890;
static constexpr uint32_t PROTOCOL_VERSION_1_0 = 0x00010000UL;
static constexpr uint32_t PROTOCOL_VERSION_1_1 = 0x00010001UL;
static constexpr uint32_t PROTOCOL_VERSION_1_2 = 0x00010002UL;
static constexpr uint32_t PROTOCOL_VERSION_1_3 = 0x00010003UL;
static constexpr uint32_t SUPPORTED_PROTOCOL_VERSION = PROTOCOL_VERSION_1_2;
static constexpr uint32_t SUPPORTED_PROTOCOL_VERSION = PROTOCOL_VERSION_1_3;
class P2PServer : public TCPServer
{
@@ -55,7 +57,9 @@ public:
PEER_LIST_RESPONSE,
BLOCK_BROADCAST_COMPACT,
BLOCK_NOTIFY,
LAST = BLOCK_NOTIFY,
// Donation messages are signed by author's private keys to prevent their abuse/misuse.
AUX_JOB_DONATION,
LAST = AUX_JOB_DONATION,
};
explicit P2PServer(p2pool *pool);
@@ -113,6 +117,7 @@ public:
[[nodiscard]] bool on_peer_list_request(const uint8_t* buf);
void on_peer_list_response(const uint8_t* buf);
void on_block_notify(const uint8_t* buf);
[[nodiscard]] bool on_aux_job_donation(const uint8_t* buf, uint32_t size);
[[nodiscard]] bool handle_incoming_block_async(const PoolBlock* block, uint64_t max_time_delta = 0);
static void handle_incoming_block(p2pool* pool, PoolBlock& block, std::vector<hash>& missing_blocks, bool& result);
@@ -188,6 +193,12 @@ public:
bool disconnected() const { return m_seenGoodPeers && (m_numConnections == 0); };
#ifdef WITH_MERGE_MINING_DONATION
void broadcast_aux_job_donation_async(const uint8_t* data, uint32_t data_size, uint64_t timestamp);
#endif
void broadcast_aux_job_donation(const uint8_t* data, uint32_t data_size, uint64_t timestamp, const P2PClient* source, bool duplicate_check_done);
private:
[[nodiscard]] const char* get_log_category() const override;
@@ -291,6 +302,34 @@ private:
void on_shutdown() override;
void api_update_local_stats();
enum {
AUX_JOB_TIMEOUT = 3600,
};
unordered_set<std::pair<uint64_t, uint64_t>> m_auxJobMessages;
std::vector<uint8_t> m_auxJobLastMessage;
uint64_t m_auxJobLastMessageTimestamp;
void send_aux_job_donation(P2PServer::P2PClient* client, const uint8_t* data, uint32_t data_size);
void clean_aux_job_messages();
#ifdef WITH_MERGE_MINING_DONATION
struct AuxJobBroadcast
{
std::vector<uint8_t> job;
uint64_t timestamp = 0;
};
uv_mutex_t m_AuxJobBroadcastLock;
AuxJobBroadcast m_AuxJobBroadcast;
uv_async_t m_AuxJobBroadcastAsync;
static void on_aux_job_broadcast(uv_async_t* handle) { reinterpret_cast<P2PServer*>(handle->data)->broadcast_aux_job_donation_handler(); }
void broadcast_aux_job_donation_handler();
#endif
};
} // namespace p2pool
+326 -35
View File
@@ -38,14 +38,17 @@
#include "keccak.h"
#include "merkle.h"
#include "merge_mining_client.h"
#ifdef WITH_TLS
#include <openssl/curve25519.h>
#endif
#include <thread>
#include <fstream>
#include <numeric>
LOG_CATEGORY(P2Pool)
constexpr int BLOCK_HEADERS_REQUIRED = 720;
constexpr uint64_t SEEDHASH_EPOCH_BLOCKS = 2048;
constexpr uint64_t SEEDHASH_EPOCH_LAG = 64;
@@ -53,6 +56,8 @@ constexpr char FOUND_BLOCKS_FILE[] = "p2pool.blocks";
namespace p2pool {
static uint64_t BLOCK_HEADERS_REQUIRED = 720;
p2pool::p2pool(int argc, char* argv[])
: m_stopped(false)
, m_updateSeed(true)
@@ -73,6 +78,11 @@ p2pool::p2pool(int argc, char* argv[])
m_params = p;
// P2Pool-nano requires more Monero blocks for the initial sync
if (m_params->m_nano) {
BLOCK_HEADERS_REQUIRED = 1440;
}
bkg_jobs_tracker = new BackgroundJobTracker();
#ifdef WITH_UPNP
@@ -148,11 +158,18 @@ p2pool::p2pool(int argc, char* argv[])
uv_rwlock_init_checked(&m_minerDataLock);
uv_rwlock_init_checked(&m_ZMQReaderLock);
uv_rwlock_init_checked(&m_mergeMiningClientsLock);
#ifdef WITH_MERGE_MINING_DONATION
uv_rwlock_init_checked(&m_auxJobDonationLock);
#endif
uv_rwlock_init_checked(&m_auxIdLock);
uv_mutex_init_checked(&m_foundBlocksLock);
#ifdef WITH_RANDOMX
uv_mutex_init_checked(&m_minerLock);
#endif
uv_mutex_init_checked(&m_submitBlockDataLock);
uv_mutex_init_checked(&m_submitAuxBlockDataLock);
@@ -163,10 +180,10 @@ p2pool::p2pool(int argc, char* argv[])
throw std::exception();
}
m_sideChain = new SideChain(this, type, p->m_mini ? "mini" : nullptr);
m_sideChain = new SideChain(this, type, p->m_mini ? "mini" : (p->m_nano ? "nano" : nullptr));
if (p->m_p2pAddresses.empty()) {
const int p2p_port = m_sideChain->is_mini() ? DEFAULT_P2P_PORT_MINI : DEFAULT_P2P_PORT;
const int p2p_port = m_sideChain->is_mini() ? DEFAULT_P2P_PORT_MINI : (m_sideChain->is_nano() ? DEFAULT_P2P_PORT_NANO : DEFAULT_P2P_PORT);
char buf[48] = {};
log::Stream s(buf);
@@ -222,11 +239,18 @@ p2pool::~p2pool()
uv_rwlock_destroy(&m_minerDataLock);
uv_rwlock_destroy(&m_ZMQReaderLock);
uv_rwlock_destroy(&m_mergeMiningClientsLock);
#ifdef WITH_MERGE_MINING_DONATION
uv_rwlock_destroy(&m_auxJobDonationLock);
#endif
uv_rwlock_destroy(&m_auxIdLock);
uv_mutex_destroy(&m_foundBlocksLock);
#ifdef WITH_RANDOMX
uv_mutex_destroy(&m_minerLock);
#endif
uv_mutex_destroy(&m_submitBlockDataLock);
uv_mutex_destroy(&m_submitAuxBlockDataLock);
@@ -565,6 +589,27 @@ void p2pool::handle_chain_main(ChainMain& data, const char* extra)
m_zmqLastActive = seconds_since_epoch();
}
#ifdef WITH_MERGE_MINING_DONATION
void p2pool::set_aux_job_donation(const std::vector<IMergeMiningClient::ChainParameters>& chain_params)
{
if (m_stopped) {
return;
}
const uint64_t t = seconds_since_epoch();
{
WriteLock lock(m_auxJobDonationLock);
m_auxJobDonation = chain_params;
m_auxJobDonationLastUpdated = t;
}
if (!chain_params.empty()) {
update_aux_data(chain_params.front().aux_id);
}
}
#endif
void p2pool::update_aux_data(const hash& chain_id)
{
if (m_stopped) {
@@ -574,6 +619,22 @@ void p2pool::update_aux_data(const hash& chain_id)
MinerData data;
std::vector<hash> aux_id;
#ifdef WITH_MERGE_MINING_DONATION
std::vector<IMergeMiningClient::ChainParameters> mm_donation_params;
uint64_t mm_donation_params_last_updated;
{
ReadLock lock(m_auxJobDonationLock);
mm_donation_params = m_auxJobDonation;
mm_donation_params_last_updated = m_auxJobDonationLastUpdated;
}
const uint64_t t = seconds_since_epoch();
if (!mm_donation_params.empty()) {
LOGINFO(5, "update_aux_data: there are " << mm_donation_params.size() << " aux chain datas for merge mining donation, last updated " << (t - mm_donation_params_last_updated) << " seconds ago");
}
#endif
{
ReadLock lock(m_mergeMiningClientsLock);
@@ -588,13 +649,33 @@ void p2pool::update_aux_data(const hash& chain_id)
if (c->get_params(chain_params)) {
data.aux_chains.emplace_back(chain_params.aux_id, chain_params.aux_hash, chain_params.aux_diff);
aux_id.emplace_back(chain_params.aux_id);
#ifdef WITH_MERGE_MINING_DONATION
// If the user is already merge mining this chain, don't use it for donation
mm_donation_params.erase(std::remove_if(mm_donation_params.begin(), mm_donation_params.end(), [&chain_params](const auto& t) { return t.aux_id == chain_params.aux_id; }), mm_donation_params.end());
#endif
}
}
aux_id.emplace_back(m_sideChain->consensus_hash());
}
}
if (!aux_id.empty()) {
#ifdef WITH_MERGE_MINING_DONATION
// Use the donation job for 30 minutes at most if it doesn't get updated anymore
if (t <= mm_donation_params_last_updated + 1800) {
LOGINFO(5, "update_aux_data: using " << mm_donation_params.size() << " aux chain datas for merge mining donation");
for (const IMergeMiningClient::ChainParameters& c : mm_donation_params) {
data.aux_chains.emplace_back(c.aux_id, c.aux_hash, c.aux_diff);
aux_id.emplace_back(c.aux_id);
}
}
else if (mm_donation_params_last_updated) {
LOGINFO(5, "update_aux_data: merge mining donation data is stale, not using it");
}
#endif
aux_id.emplace_back(m_sideChain->consensus_hash());
{
WriteLock lock(m_auxIdLock);
if (aux_id == m_auxId) {
@@ -605,7 +686,7 @@ void p2pool::update_aux_data(const hash& chain_id)
m_auxNonce = data.aux_nonce;
}
else {
LOGERR(1, "Failed to find the aux nonce for merge mining. Merge mining will be off this round.");
LOGERR(1, "update_aux_data: failed to find the aux nonce for merge mining. Merge mining will be off this round.");
data.aux_chains.clear();
}
}
@@ -623,16 +704,113 @@ void p2pool::update_aux_data(const hash& chain_id)
}
if (!chain_id.empty()) {
LOGINFO(4, "New aux data from chain " << chain_id);
LOGINFO(4, "update_aux_data: new aux data from chain " << chain_id);
if (!is_main_thread()) {
update_block_template_async();
}
else {
update_block_template();
}
#if defined(WITH_MERGE_MINING_DONATION) && defined(WITH_TLS)
send_aux_job_donation();
#endif
api_update_aux_data();
}
}
#ifdef WITH_MERGE_MINING_DONATION
void p2pool::send_aux_job_donation()
{
#ifdef WITH_TLS
if (m_params->m_authorKeyFile.empty()) {
return;
}
std::ifstream f(m_params->m_authorKeyFile, std::ios::binary | std::ios::ate);
if (!f.good()) {
LOGERR(1, "send_aux_job_donation: failed to open " << m_params->m_authorKeyFile);
return;
}
Params::AuthorKey key;
if (f.tellg() != static_cast<std::streampos>(sizeof(key))) {
LOGERR(1, "send_aux_job_donation: " << m_params->m_authorKeyFile << " has an invalid size");
return;
}
f.seekg(0);
f.read(reinterpret_cast<char*>(&key), sizeof(key));
if (!f.good()) {
LOGERR(1, "send_aux_job_donation: failed to read data from " << m_params->m_authorKeyFile);
return;
}
const uint64_t timestamp = time(nullptr);
if (timestamp >= read_unaligned(reinterpret_cast<uint64_t*>(key.expiration_time))) {
LOGERR(1, "send_aux_job_donation: " << m_params->m_authorKeyFile << " is expired");
return;
}
const uint8_t* p = reinterpret_cast<uint8_t*>(&key);
if (!ED25519_verify(p, sizeof(key.pub_key) + sizeof(key.expiration_time), key.master_key_signature, ED25519_MASTER_PUBLIC_KEY)) {
LOGERR(1, "send_aux_job_donation: " << m_params->m_authorKeyFile << ": signature verification failed");
return;
}
std::vector<uint8_t> job;
job.reserve(512);
constexpr uint32_t DATA_OFFSET = sizeof(key.pub_key) + sizeof(key.expiration_time) + sizeof(key.master_key_signature);
job.assign(p, p + DATA_OFFSET);
job.insert(job.end(), reinterpret_cast<const uint8_t*>(&timestamp), reinterpret_cast<const uint8_t*>(&timestamp) + sizeof(uint64_t));
{
ReadLock lock(m_minerDataLock);
if (m_minerData.aux_chains.empty()) {
LOGERR(1, "send_aux_job_donation: no merge mined chains found");
return;
}
for (const AuxChainData& c : m_minerData.aux_chains) {
job.insert(job.end(), c.unique_id.h, c.unique_id.h + HASH_SIZE);
job.insert(job.end(), c.data.h, c.data.h + HASH_SIZE);
job.insert(job.end(), reinterpret_cast<const uint8_t*>(&c.difficulty), reinterpret_cast<const uint8_t*>(&c.difficulty) + sizeof(difficulty_type));
}
}
uint8_t signature[64];
if (!ED25519_sign(signature, job.data() + DATA_OFFSET, job.size() - DATA_OFFSET, key.priv_key)) {
LOGERR(1, "send_aux_job_donation: failed to sign the donation job");
return;
}
if (!ED25519_verify(job.data() + DATA_OFFSET, job.size() - DATA_OFFSET, signature, key.pub_key)) {
LOGERR(1, "send_aux_job_donation: failed to verify the donation job's signature");
return;
}
OPENSSL_cleanse(&key, sizeof(key));
job.insert(job.end(), signature, signature + sizeof(signature));
m_p2pServer->broadcast_aux_job_donation_async(job.data(), static_cast<uint32_t>(job.size()), timestamp);
#else
LOGERR(1, "p2pool::send_aux_job_donation() must be built with TLS");
#endif
}
#endif
void p2pool::submit_block_async(uint32_t template_id, uint32_t nonce, uint32_t extra_nonce)
{
{
@@ -769,7 +947,7 @@ void p2pool::submit_aux_block() const
}
}
c->submit_solution(block_tpl, hashing_blob, nonce_offset, seed_hash, blob, proof, path);
c->submit_solution(block_tpl->get_coinbase_merkle_proof(), hashing_blob, nonce_offset, seed_hash, blob, proof, path);
}
else {
LOGWARN(3, "submit_aux_block: failed to get merkle proof for chain_id " << chain_id);
@@ -977,7 +1155,7 @@ void p2pool::update_block_template()
#endif
}
void p2pool::download_block_headers(uint64_t current_height)
void p2pool::download_block_headers1(uint64_t current_height)
{
const uint64_t seed_height = get_seed_height(current_height);
const uint64_t prev_seed_height = (seed_height > SEEDHASH_EPOCH_BLOCKS) ? (seed_height - SEEDHASH_EPOCH_BLOCKS) : 0;
@@ -987,37 +1165,107 @@ void p2pool::download_block_headers(uint64_t current_height)
const Params::Host& host = current_host();
// First download 2 RandomX seeds
const uint64_t seed_heights[2] = { prev_seed_height, seed_height };
for (uint64_t height : seed_heights) {
s.m_pos = 0;
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_header_by_height\",\"params\":{\"height\":" << prev_seed_height << "}}\0";
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
[this, prev_seed_height, current_height](const char* data, size_t size, double) {
ChainMain block;
if (parse_block_header(data, size, block)) {
// Do it synchronously to make sure stratum and p2p don't start before it's finished
m_hasher->set_old_seed(block.id);
download_block_headers2(current_height);
}
else {
LOGERR(1, "fatal error: couldn't download block header for seed height " << prev_seed_height);
download_block_headers1(current_height);
}
},
[this, prev_seed_height, current_height](const char* data, size_t size, double) {
if (size > 0) {
LOGERR(1, "fatal error: couldn't download block header for seed height " << prev_seed_height << ", error " << log::const_buf(data, size));
download_block_headers1(current_height);
}
});
}
void p2pool::download_block_headers2(uint64_t current_height)
{
const uint64_t seed_height = get_seed_height(current_height);
char buf[log::Stream::BUF_SIZE + 1] = {};
log::Stream s(buf);
const Params::Host& host = current_host();
s.m_pos = 0;
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_header_by_height\",\"params\":{\"height\":" << seed_height << "}}\0";
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
[this, seed_height, current_height](const char* data, size_t size, double) {
ChainMain block;
if (parse_block_header(data, size, block)) {
const uint64_t start_height = (current_height > BLOCK_HEADERS_REQUIRED) ? (current_height - BLOCK_HEADERS_REQUIRED) : 0;
download_block_headers3(start_height, current_height);
}
else {
LOGERR(1, "fatal error: couldn't download block header for seed height " << seed_height);
download_block_headers2(current_height);
}
},
[this, seed_height, current_height](const char* data, size_t size, double) {
if (size > 0) {
LOGERR(1, "fatal error: couldn't download block header for seed height " << seed_height << ", error " << log::const_buf(data, size));
download_block_headers2(current_height);
}
});
}
void p2pool::download_block_headers3(uint64_t start_height, uint64_t current_height)
{
// Workaround the restricted RPC limit
constexpr uint64_t RESTRICTED_BLOCK_HEADER_RANGE = 1000;
if (current_height - start_height > RESTRICTED_BLOCK_HEADER_RANGE + 1) {
char buf[log::Stream::BUF_SIZE + 1] = {};
log::Stream s(buf);
const Params::Host& host = current_host();
const uint64_t next_height = start_height + RESTRICTED_BLOCK_HEADER_RANGE;
s.m_pos = 0;
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_header_by_height\",\"params\":{\"height\":" << height << "}}\0";
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_headers_range\",\"params\":{\"start_height\":" << start_height << ",\"end_height\":" << next_height << "}}\0";
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
[this, prev_seed_height, height](const char* data, size_t size, double)
{
ChainMain block;
if (parse_block_header(data, size, block)) {
if (height == prev_seed_height) {
// Do it synchronously to make sure stratum and p2p don't start before it's finished
m_hasher->set_old_seed(block.id);
}
[this, start_height, next_height, host, current_height](const char* data, size_t size, double) {
if (parse_block_headers_range(data, size) == next_height - start_height + 1) {
download_block_headers3(next_height + 1, current_height);
}
else {
LOGERR(1, "fatal error: couldn't download block header for seed height " << height);
PANIC_STOP();
LOGERR(1, "Couldn't download block headers for heights " << start_height << " - " << next_height);
download_block_headers3(start_height, current_height);
}
},
[height](const char* data, size_t size, double)
{
[this, start_height, next_height, current_height](const char* data, size_t size, double) {
if (size > 0) {
LOGERR(1, "fatal error: couldn't download block header for seed height " << height << ", error " << log::const_buf(data, size));
PANIC_STOP();
LOGERR(1, "Couldn't download block headers for heights " << start_height << " - " << next_height << ", error " << log::const_buf(data, size));
download_block_headers3(start_height, current_height);
}
});
}
);
}
else {
download_block_headers4(start_height, current_height);
}
}
const uint64_t start_height = (current_height > BLOCK_HEADERS_REQUIRED) ? (current_height - BLOCK_HEADERS_REQUIRED) : 0;
void p2pool::download_block_headers4(uint64_t start_height, uint64_t current_height)
{
char buf[log::Stream::BUF_SIZE + 1] = {};
log::Stream s(buf);
const Params::Host& host = current_host();
s.m_pos = 0;
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_headers_range\",\"params\":{\"start_height\":" << start_height << ",\"end_height\":" << current_height - 1 << "}}\0";
@@ -1080,14 +1328,14 @@ void p2pool::download_block_headers(uint64_t current_height)
}
else {
LOGERR(1, "Couldn't download block headers for heights " << start_height << " - " << current_height - 1);
download_block_headers(current_height);
download_block_headers4(start_height, current_height);
}
},
[this, start_height, current_height](const char* data, size_t size, double)
{
if (size > 0) {
LOGERR(1, "Couldn't download block headers for heights " << start_height << " - " << current_height - 1 << ", error " << log::const_buf(data, size));
download_block_headers(current_height);
download_block_headers4(start_height, current_height);
}
});
}
@@ -1232,6 +1480,7 @@ void p2pool::parse_get_info_rpc(const char* data, size_t size)
if (doc.HasParseError() || !doc.IsObject() || !doc.HasMember("result")) {
LOGWARN(1, "get_info RPC response is invalid (\"result\" not found), trying again in 1 second");
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
switch_host();
get_info();
return;
}
@@ -1249,6 +1498,7 @@ void p2pool::parse_get_info_rpc(const char* data, size_t size)
!PARSE(result, info, stagenet)) {
LOGWARN(1, "get_info RPC response is invalid, trying again in 1 second");
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
switch_host();
get_info();
return;
}
@@ -1256,6 +1506,7 @@ void p2pool::parse_get_info_rpc(const char* data, size_t size)
if (info.busy_syncing || !info.synchronized) {
LOGINFO(1, "monerod is " << (info.busy_syncing ? "busy syncing" : "not synchronized") << ", trying again in 1 second");
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
switch_host();
get_info();
return;
}
@@ -1436,7 +1687,7 @@ void p2pool::parse_get_miner_data_rpc(const char* data, size_t size)
handle_miner_data(minerData);
if (m_serversStarted.load() == 0) {
download_block_headers(minerData.height);
download_block_headers1(minerData.height);
}
}
@@ -1690,7 +1941,7 @@ void p2pool::cleanup_mainchain_data(uint64_t height)
// Expects m_mainchainLock to be already locked here
// Deletes everything older than 720 blocks, except for the 3 latest RandomX seed heights
constexpr uint64_t PRUNE_DISTANCE = BLOCK_HEADERS_REQUIRED;
const uint64_t PRUNE_DISTANCE = BLOCK_HEADERS_REQUIRED;
const uint64_t seed_height = get_seed_height(height);
const std::array<uint64_t, 3> seed_heights{ seed_height, seed_height - SEEDHASH_EPOCH_BLOCKS, seed_height - SEEDHASH_EPOCH_BLOCKS * 2 };
@@ -1766,6 +2017,39 @@ void p2pool::api_update_block_found(const ChainMain* data, const PoolBlock* bloc
}
}
void p2pool::on_external_block(const PoolBlock& block)
{
ReadLock lock(m_mergeMiningClientsLock);
for (IMergeMiningClient* c : m_mergeMiningClients) {
c->on_external_block(block);
}
}
void p2pool::api_update_aux_data()
{
if (!m_api || !m_params->m_localStats || m_stopped) {
return;
}
m_api->set(p2pool_api::Category::LOCAL, "merge_mining",
[this](log::Stream& s)
{
s << "{\"chains\":[";
{
ReadLock lock(m_mergeMiningClientsLock);
for (size_t i = 0, n = m_mergeMiningClients.size(); i < n; ++i) {
if (i > 0) {
s << ',';
}
m_mergeMiningClients[i]->api_status(s);
}
}
s << "]}";
});
}
bool p2pool::get_difficulty_at_height(uint64_t height, difficulty_type& diff)
{
ReadLock lock(m_mainchainLock);
@@ -1953,6 +2237,8 @@ int p2pool::run()
loop->data = nullptr;
GetLoopUserData(loop);
set_thread_name("p2pool");
try {
get_info();
load_found_blocks();
@@ -1974,7 +2260,12 @@ int p2pool::run()
bkg_jobs_tracker->wait();
#ifdef WITH_RANDOMX
delete m_miner;
{
MutexLock lock(m_minerLock);
delete m_miner;
m_miner = nullptr;
}
#endif
delete m_stratumServer;
delete m_p2pServer;
+20 -1
View File
@@ -19,6 +19,7 @@
#include "uv_util.h"
#include "params.h"
#include "merge_mining_client.h"
#include <map>
namespace p2pool {
@@ -86,6 +87,11 @@ public:
virtual void handle_miner_data(MinerData& data) override;
virtual void handle_chain_main(ChainMain& data, const char* extra) override;
#ifdef WITH_MERGE_MINING_DONATION
void set_aux_job_donation(const std::vector<IMergeMiningClient::ChainParameters>& chain_params);
void send_aux_job_donation();
#endif
void update_aux_data(const hash& chain_id);
void submit_block_async(uint32_t template_id, uint32_t nonce, uint32_t extra_nonce);
@@ -106,11 +112,18 @@ public:
void update_block_template_async(bool is_alternative_block = false);
void update_block_template();
void download_block_headers(uint64_t current_height);
// TODO refactor this bullshit later
void download_block_headers1(uint64_t current_height);
void download_block_headers2(uint64_t current_height);
void download_block_headers3(uint64_t start_height, uint64_t current_height);
void download_block_headers4(uint64_t start_height, uint64_t current_height);
bool chainmain_get_by_hash(const hash& id, ChainMain& data) const;
void api_update_block_found(const ChainMain* data, const PoolBlock* block, bool update_stats_mod = true);
void on_external_block(const PoolBlock& block);
void api_update_aux_data();
bool get_difficulty_at_height(uint64_t height, difficulty_type& diff);
@@ -251,6 +264,12 @@ private:
mutable uv_rwlock_t m_mergeMiningClientsLock;
std::vector<IMergeMiningClient*> m_mergeMiningClients;
#ifdef WITH_MERGE_MINING_DONATION
mutable uv_rwlock_t m_auxJobDonationLock;
std::vector<IMergeMiningClient::ChainParameters> m_auxJobDonation;
uint64_t m_auxJobDonationLastUpdated = 0;
#endif
mutable uv_rwlock_t m_auxIdLock;
std::vector<hash> m_auxId;
uint32_t m_auxNonce = 0;
+11 -6
View File
@@ -64,11 +64,11 @@ p2pool_api::p2pool_api(const std::string& api_path, const bool local_stats)
m_poolPath = m_apiPath + "pool/";
m_localPath = m_apiPath + "local/";
create_dir(m_networkPath);
create_dir(m_poolPath);
create_dir(m_networkPath, false);
create_dir(m_poolPath, false);
if (local_stats) {
create_dir(m_localPath);
create_dir(m_localPath, true);
}
}
@@ -77,14 +77,16 @@ p2pool_api::~p2pool_api()
uv_mutex_destroy(&m_dumpDataLock);
}
void p2pool_api::create_dir(const std::string& path)
void p2pool_api::create_dir(const std::string& path, bool is_restricted)
{
(void) is_restricted;
#ifdef _MSC_VER
int result = _mkdir(path.c_str());
#else
int result = mkdir(path.c_str()
#ifndef _WIN32
, 0775
, is_restricted ? 0750 : 0775
#endif
);
#endif
@@ -169,7 +171,10 @@ void p2pool_api::dump_to_file()
#endif
;
const int result = uv_fs_open(uv_default_loop_checked(), &work->req, work->tmp_name.c_str(), flags, 0644, on_fs_open);
// LOCAL category has restricted access
const int mode = (work->tmp_name.find(m_localPath) == 0) ? 0640 : 0644;
const int result = uv_fs_open(uv_default_loop_checked(), &work->req, work->tmp_name.c_str(), flags, mode, on_fs_open);
if (result < 0) {
LOGWARN(4, "failed to open " << work->tmp_name << ", error " << uv_err_name(result));
delete work;
+1 -1
View File
@@ -41,7 +41,7 @@ public:
void set(Category category, const char* filename, T&& callback) { dump_to_file_async_internal(category, filename, Callback<void, log::Stream&>::Derived<T>(std::move(callback))); }
private:
void create_dir(const std::string& path);
void create_dir(const std::string& path, bool is_restricted);
static void on_dump_to_file(uv_async_t* async) { reinterpret_cast<p2pool_api*>(async->data)->dump_to_file(); }
+33
View File
@@ -26,6 +26,9 @@ void p2pool_usage();
namespace p2pool {
static constexpr uint64_t MIN_STRATUM_BAN_TIME = UINT64_C(1);
static constexpr uint64_t MAX_STRATUM_BAN_TIME = (UINT64_C(1) << 34) - 1;
Params::Params(int argc, char* const argv[])
{
for (int i = 1; i < argc; ++i) {
@@ -79,6 +82,11 @@ Params::Params(int argc, char* const argv[])
ok = true;
}
if ((strcmp(argv[i], "--stratum-ban-time") == 0) && (i + 1 < argc)) {
m_stratumBanTime = strtoull(argv[++i], nullptr, 10);
ok = true;
}
if ((strcmp(argv[i], "--p2p") == 0) && (i + 1 < argc)) {
m_p2pAddresses = argv[++i];
ok = true;
@@ -153,6 +161,11 @@ Params::Params(int argc, char* const argv[])
ok = true;
}
if (strcmp(argv[i], "--nano") == 0) {
m_nano = true;
ok = true;
}
if (strcmp(argv[i], "--no-autodiff") == 0) {
m_autoDiff = false;
ok = true;
@@ -238,6 +251,13 @@ Params::Params(int argc, char* const argv[])
ok = true;
}
#ifdef WITH_MERGE_MINING_DONATION
if ((strcmp(argv[i], "--adkf") == 0) && (i + 1 < argc)) {
m_authorKeyFile = argv[++i];
ok = true;
}
#endif
if (!ok) {
// Wait to avoid log messages overlapping with printf() calls and making a mess on screen
std::this_thread::sleep_for(std::chrono::milliseconds(10));
@@ -272,6 +292,14 @@ Params::Params(int argc, char* const argv[])
m_stratumAddresses = buf;
}
if(m_stratumBanTime < MIN_STRATUM_BAN_TIME) {
LOGWARN(1, "Value for --stratum-ban-time is too low, adjusting to " << MIN_STRATUM_BAN_TIME);
m_stratumBanTime = MIN_STRATUM_BAN_TIME;
} else if(m_stratumBanTime > MAX_STRATUM_BAN_TIME) {
LOGWARN(1, "Value for --stratum-ban-time is too high, adjusting to " << MAX_STRATUM_BAN_TIME);
m_stratumBanTime = MAX_STRATUM_BAN_TIME;
}
}
bool Params::valid() const
@@ -293,6 +321,11 @@ bool Params::valid() const
}
#endif
if (m_mini && m_nano) {
LOGERR(1, "You can't have both --mini and --nano in the command line");
return false;
}
return true;
}
+15
View File
@@ -21,6 +21,8 @@
namespace p2pool {
static constexpr uint64_t DEFAULT_STRATUM_BAN_TIME = 600;
struct Params
{
Params(int argc, char* const argv[]);
@@ -74,6 +76,7 @@ struct Params
std::string m_p2pPeerList;
std::string m_sidechainConfig;
std::string m_apiPath;
uint64_t m_stratumBanTime = DEFAULT_STRATUM_BAN_TIME;
bool m_localStats = false;
bool m_blockCache = true;
#ifdef WITH_RANDOMX
@@ -85,6 +88,7 @@ struct Params
uint32_t m_maxIncomingPeers = 450;
uint32_t m_minerThreads = 0;
bool m_mini = false;
bool m_nano = false;
bool m_autoDiff = true;
std::string m_socks5Proxy;
bool m_dns = true;
@@ -101,6 +105,17 @@ struct Params
std::string m_tlsCertKey;
#endif
bool m_enableStratumHTTP = true;
#ifdef WITH_MERGE_MINING_DONATION
std::string m_authorKeyFile;
struct AuthorKey {
uint8_t pub_key[32];
uint8_t expiration_time[8];
uint8_t master_key_signature[64];
uint8_t priv_key[64];
};
#endif
};
} // namespace p2pool
+26
View File
@@ -128,6 +128,11 @@ PoolBlock& PoolBlock::operator=(const PoolBlock& b)
m_auxChains = b.m_auxChains;
m_auxNonce = b.m_auxNonce;
m_hashingBlob = b.m_hashingBlob;
m_powHash = b.m_powHash;
m_seed = b.m_seed;
return *this;
}
@@ -321,18 +326,32 @@ void PoolBlock::reset_offchain_data()
m_auxChains.shrink_to_fit();
m_auxNonce = 0;
m_hashingBlob.clear();
m_hashingBlob.shrink_to_fit();
m_powHash = {};
m_seed = {};
}
bool PoolBlock::get_pow_hash(RandomX_Hasher_Base* hasher, uint64_t height, const hash& seed_hash, hash& pow_hash, bool force_light_mode)
{
// Calculate the coinbase tx hash, then the merkle root of all transactions in the block - this merkle root is what goes into the hashing blob
// Monero transactions are hashed in 3 separate parts, the resulting 3 hashes are then hashed together to get the final result
// For the reference, see "calculate_transaction_hash" in Monero's src/cryptonote_basic/cryptonote_format_utils.cpp
alignas(8) uint8_t hashes[HASH_SIZE * 3];
uint64_t* second_hash = reinterpret_cast<uint64_t*>(hashes + HASH_SIZE);
// Second hash is keccak of base rct data (it doesn't exist for the coinbase transaction, so it's a hash of a single 0x00 byte)
second_hash[0] = 0x14281e7a9e7836bcull;
second_hash[1] = 0x7d818f8229424636ull;
second_hash[2] = 0x9165d677b4f71266ull;
second_hash[3] = 0x8ac9bc64e0a996ffull;
// Third hash is null because there is no rct data in the coinbase transaction
memset(hashes + HASH_SIZE * 2, 0, HASH_SIZE);
uint64_t count;
@@ -354,6 +373,8 @@ bool PoolBlock::get_pow_hash(RandomX_Hasher_Base* hasher, uint64_t height, const
const uint8_t* miner_tx = mainchain_data.data() + header_size;
hash tmp;
// "miner_tx_size - 1" because the last byte is 0x00 (base rct data), it goes into the second hash
keccak(miner_tx, static_cast<int>(miner_tx_size) - 1, tmp.h);
memcpy(hashes, tmp.h, HASH_SIZE);
@@ -361,6 +382,8 @@ bool PoolBlock::get_pow_hash(RandomX_Hasher_Base* hasher, uint64_t height, const
uint8_t* h = reinterpret_cast<uint8_t*>(m_transactions.data());
keccak(reinterpret_cast<uint8_t*>(hashes), HASH_SIZE * 3, tmp.h);
// Save the coinbase tx hash into the first element of m_transactions
memcpy(h, tmp.h, HASH_SIZE);
root_hash tmp_root;
@@ -371,6 +394,9 @@ bool PoolBlock::get_pow_hash(RandomX_Hasher_Base* hasher, uint64_t height, const
writeVarint(count, [&blob, &blob_size](uint8_t b) { blob[blob_size++] = b; });
// cppcheck-suppress danglingLifetime
m_hashingBlob.assign(blob, blob + blob_size);
return hasher->calculate(blob, blob_size, height, seed_hash, pow_hash, force_light_mode);
}
+8 -2
View File
@@ -20,6 +20,8 @@
#include "uv_util.h"
#include "wallet.h"
#include <map>
#if defined(_DEBUG) || defined(DEV_DEBUG)
#define POOL_BLOCK_DEBUG 1
#else
@@ -142,8 +144,8 @@ struct PoolBlock
// Merge mining extra data
// Format: vector of (chain ID, chain data) pairs
// Chain data format is arbitrary and depends on the merge mined chain's requirements
std::vector<std::pair<hash, std::vector<uint8_t>>> m_mergeMiningExtra;
// Chain data always has merge mining hash and difficulty in the beginning, the rest is arbitrary and depends on the merge mined chain's requirements
std::map<hash, std::vector<uint8_t>> m_mergeMiningExtra;
// Arbitrary extra data
uint32_t m_sidechainExtraBuf[4];
@@ -171,6 +173,10 @@ struct PoolBlock
std::vector<AuxChainData> m_auxChains;
uint32_t m_auxNonce;
std::vector<uint8_t> m_hashingBlob;
hash m_powHash;
hash m_seed;
std::vector<uint8_t> serialize_mainchain_data(size_t* header_size = nullptr, size_t* miner_tx_size = nullptr, int* outputs_offset = nullptr, int* outputs_blob_size = nullptr, const uint32_t* nonce = nullptr, const uint32_t* extra_nonce = nullptr) const;
std::vector<uint8_t> serialize_sidechain_data() const;
+5 -4
View File
@@ -370,14 +370,15 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
if (mm_extra_data_count > MERGE_MINING_MAX_CHAINS) return __LINE__;
if (static_cast<uint64_t>(data_end - data) < mm_extra_data_count * (HASH_SIZE + 1)) return __LINE__;
m_mergeMiningExtra.reserve(mm_extra_data_count);
hash prev_chain_id;
for (uint64_t i = 0; i < mm_extra_data_count; ++i) {
hash chain_id;
READ_BUF(chain_id.h, HASH_SIZE);
// IDs must be ordered to avoid duplicates
if (i && !(m_mergeMiningExtra[i - 1].first < chain_id)) return __LINE__;
if (i && !(prev_chain_id < chain_id)) return __LINE__;
prev_chain_id = chain_id;
uint64_t n;
READ_VARINT(n);
@@ -390,7 +391,7 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
READ_BUF(t.data(), n);
m_mergeMiningExtra.emplace_back(chain_id, std::move(t));
m_mergeMiningExtra.emplace(chain_id, std::move(t));
}
}
+4 -1
View File
@@ -84,7 +84,7 @@ RandomX_Hasher::RandomX_Hasher(p2pool* pool)
memory_allocated = (memory_allocated + (1 << 20) - 1) >> 20;
LOGINFO(1, "allocated " << memory_allocated << " MB");
LOGINFO(1, "allocated " << memory_allocated << " MiB");
}
RandomX_Hasher::~RandomX_Hasher()
@@ -244,6 +244,7 @@ void RandomX_Hasher::set_seed(const hash& seed)
{
// Background doesn't work very well with xmrig mining on all cores
//make_thread_background();
set_thread_name("Dataset init");
randomx_init_dataset(m_dataset, m_cache[m_index], a, b - a);
});
}
@@ -426,6 +427,8 @@ void RandomX_Hasher_RPC::loop(void* data)
{
LOGINFO(1, "event loop started");
set_thread_name("RX hash RPC");
RandomX_Hasher_RPC* hasher = static_cast<RandomX_Hasher_RPC*>(data);
int err = uv_run(&hasher->m_loop, UV_RUN_DEFAULT);
+28 -10
View File
@@ -57,6 +57,7 @@ namespace p2pool {
static constexpr uint8_t default_consensus_id[HASH_SIZE] = { 34,175,126,231,181,11,104,146,227,153,218,107,44,108,68,39,178,81,4,212,169,4,142,0,177,110,157,240,68,7,249,24 };
static constexpr uint8_t mini_consensus_id[HASH_SIZE] = { 57,130,201,26,149,174,199,250,66,80,189,18,108,216,194,220,136,23,63,24,64,113,221,44,219,86,39,163,53,24,126,196 };
static constexpr uint8_t nano_consensus_id[HASH_SIZE] = { 171,248,206,148,210,226,114,99,250,145,221,96,13,216,23,63,104,53,129,168,244,80,141,138,157,250,50,54,37,189,5,89 };
NetworkType SideChain::s_networkType = NetworkType::Invalid;
@@ -84,6 +85,11 @@ SideChain::SideChain(p2pool* pool, NetworkType type, const char* pool_name)
LOGINFO(1, log::LightCyan() << "network type = " << type);
if (m_poolName == "nano") {
m_targetBlockTime = 30;
m_unclePenalty = 10;
}
if (m_pool && !load_config(m_pool->params().m_sidechainConfig)) {
PANIC_STOP();
}
@@ -118,6 +124,7 @@ SideChain::SideChain(p2pool* pool, NetworkType type, const char* pool_name)
constexpr char default_config[] = "mainnet\0" "default\0" "\0" "10\0" "100000\0" "2160\0" "20\0";
constexpr char mini_config[] = "mainnet\0" "mini\0" "\0" "10\0" "100000\0" "2160\0" "20\0";
constexpr char nano_config[] = "mainnet\0" "nano\0" "\0" "30\0" "100000\0" "2160\0" "10\0";
// Hardcoded default consensus ID
if ((s.m_pos == sizeof(default_config) - 1) && (memcmp(buf, default_config, sizeof(default_config) - 1) == 0)) {
@@ -127,6 +134,10 @@ SideChain::SideChain(p2pool* pool, NetworkType type, const char* pool_name)
else if ((s.m_pos == sizeof(mini_config) - 1) && (memcmp(buf, mini_config, sizeof(mini_config) - 1) == 0)) {
m_consensusId.assign(mini_consensus_id, mini_consensus_id + HASH_SIZE);
}
// Hardcoded nano consensus ID
else if ((s.m_pos == sizeof(nano_config) - 1) && (memcmp(buf, nano_config, sizeof(nano_config) - 1) == 0)) {
m_consensusId.assign(nano_consensus_id, nano_consensus_id + HASH_SIZE);
}
else {
#ifdef WITH_RANDOMX
const randomx_flags flags = randomx_get_flags();
@@ -573,15 +584,13 @@ bool SideChain::add_external_block(PoolBlock& block, std::vector<hash>& missing_
LOGWARN(3, "add_external_block: block is built on top of an unknown mainchain block " << block.m_prevId << ", mainchain reorg might've happened");
}
hash seed;
if (!m_pool->get_seed(block.m_txinGenHeight, seed)) {
if (!m_pool->get_seed(block.m_txinGenHeight, block.m_seed)) {
LOGWARN(3, "add_external_block mined by " << block.m_minerWallet << ": couldn't get seed hash for mainchain height " << block.m_txinGenHeight);
forget_incoming_block(block);
return false;
}
hash pow_hash;
if (!block.get_pow_hash(m_pool->hasher(), block.m_txinGenHeight, seed, pow_hash)) {
if (!block.get_pow_hash(m_pool->hasher(), block.m_txinGenHeight, block.m_seed, block.m_powHash)) {
LOGWARN(3, "add_external_block: couldn't get PoW hash for height = " << block.m_sidechainHeight << ", mainchain height " << block.m_txinGenHeight << ". Ignoring it.");
forget_incoming_block(block);
return true;
@@ -589,7 +598,7 @@ bool SideChain::add_external_block(PoolBlock& block, std::vector<hash>& missing_
// Check if it has the correct parent and difficulty to go right to monerod for checking
MinerData miner_data = m_pool->miner_data();
if ((block.m_prevId == miner_data.prev_id) && miner_data.difficulty.check_pow(pow_hash)) {
if ((block.m_prevId == miner_data.prev_id) && miner_data.difficulty.check_pow(block.m_powHash)) {
LOGINFO(0, log::LightGreen() << "add_external_block: block " << block.m_sidechainId << " has enough PoW for Monero network, submitting it");
m_pool->submit_block_async(block.serialize_mainchain_data());
}
@@ -598,13 +607,13 @@ bool SideChain::add_external_block(PoolBlock& block, std::vector<hash>& missing_
if (!m_pool->get_difficulty_at_height(block.m_txinGenHeight, diff)) {
LOGWARN(3, "add_external_block: couldn't get mainchain difficulty for height = " << block.m_txinGenHeight);
}
else if (diff.check_pow(pow_hash)) {
else if (diff.check_pow(block.m_powHash)) {
LOGINFO(0, log::LightGreen() << "add_external_block: block " << block.m_sidechainId << " has enough PoW for Monero height " << block.m_txinGenHeight << ", submitting it");
m_pool->submit_block_async(block.serialize_mainchain_data());
}
}
if (!block.m_difficulty.check_pow(pow_hash)) {
if (!block.m_difficulty.check_pow(block.m_powHash)) {
LOGWARN(3,
"add_external_block mined by " << block.m_minerWallet <<
": not enough PoW for height = " << block.m_sidechainHeight <<
@@ -617,8 +626,8 @@ bool SideChain::add_external_block(PoolBlock& block, std::vector<hash>& missing_
// Calculate the same hash second time to check if it's an unstable hardware that caused this
hash pow_hash2;
if (block.get_pow_hash(m_pool->hasher(), block.m_txinGenHeight, seed, pow_hash2, true) && (pow_hash2 != pow_hash)) {
LOGERR(0, "UNSTABLE HARDWARE DETECTED: Calculated the same hash twice, got different results: " << pow_hash << " != " << pow_hash2 << " (sidechain id = " << block.m_sidechainId << ')');
if (block.get_pow_hash(m_pool->hasher(), block.m_txinGenHeight, block.m_seed, pow_hash2, true) && (pow_hash2 != block.m_powHash)) {
LOGERR(0, "UNSTABLE HARDWARE DETECTED: Calculated the same hash twice, got different results: " << block.m_powHash << " != " << pow_hash2 << " (sidechain id = " << block.m_sidechainId << ')');
if (block.m_difficulty.check_pow(pow_hash2)) {
LOGINFO(3, "add_external_block second result has enough PoW for height = " << block.m_sidechainHeight << ", id = " << block.m_sidechainId);
not_enough_pow = false;
@@ -630,6 +639,8 @@ bool SideChain::add_external_block(PoolBlock& block, std::vector<hash>& missing_
}
}
m_pool->on_external_block(block);
bool block_found = false;
missing_blocks.clear();
@@ -1062,7 +1073,7 @@ void SideChain::print_status(bool obtain_sidechain_lock) const
"\nMonero node = " << m_pool->current_host().m_displayName <<
"\nMain chain height = " << m_pool->block_template().height() <<
"\nMain chain hashrate = " << log::Hashrate(network_hashrate) <<
"\nSide chain ID = " << (is_default() ? "default" : (is_mini() ? "mini" : m_consensusIdDisplayStr.c_str())) <<
"\nSide chain ID = " << (is_default() ? "default" : (is_mini() ? "mini" : (is_nano() ? "nano" : m_consensusIdDisplayStr.c_str()))) <<
"\nSide chain height = " << tip_height + 1 <<
"\nSide chain hashrate = " << log::Hashrate(pool_hashrate) <<
(hashrate_est ? "\nYour hashrate (pool-side) = " : "") << (hashrate_est ? log::Hashrate(hashrate_est) : log::Hashrate()) <<
@@ -1185,6 +1196,11 @@ bool SideChain::is_mini() const
return (memcmp(m_consensusId.data(), mini_consensus_id, HASH_SIZE) == 0);
}
bool SideChain::is_nano() const
{
return (memcmp(m_consensusId.data(), nano_consensus_id, HASH_SIZE) == 0);
}
uint64_t SideChain::bottom_height(const PoolBlock* tip) const
{
if (!tip) {
@@ -2370,6 +2386,8 @@ void SideChain::launch_precalc(const PoolBlock* block)
void SideChain::precalc_worker()
{
set_thread_name("Precalc");
std::vector<std::pair<size_t, const Wallet*>> wallets;
wallets.reserve(m_chainWindowSize);
+1
View File
@@ -79,6 +79,7 @@ public:
[[nodiscard]] uint64_t last_updated() const;
[[nodiscard]] bool is_default() const;
[[nodiscard]] bool is_mini() const;
[[nodiscard]] bool is_nano() const;
[[nodiscard]] uint64_t bottom_height(const PoolBlock* tip) const;
[[nodiscard]] const PoolBlock* chainTip() const { return m_chainTip; }
+38 -6
View File
@@ -29,7 +29,6 @@
LOG_CATEGORY(StratumServer)
static constexpr int DEFAULT_BACKLOG = 128;
static constexpr uint64_t DEFAULT_BAN_TIME = 600;
static constexpr uint64_t MIN_DIFF = 1000;
static constexpr uint64_t AUTO_DIFF_TARGET_TIME = 30;
@@ -58,6 +57,7 @@ StratumServer::StratumServer(p2pool* pool)
, m_cumulativeFoundSharesDiff(0.0)
, m_totalFoundSidechainShares(0)
, m_totalFailedSidechainShares(0)
, m_lastSidechainShareFoundTime(0)
, m_totalStratumShares(0)
, m_apiLastUpdateTime(0)
{
@@ -84,6 +84,7 @@ StratumServer::StratumServer(p2pool* pool)
m_showWorkersAsync.data = this;
const Params& params = pool->params();
m_banTime = params.m_stratumBanTime;
start_listening(params.m_stratumAddresses, params.m_upnp && params.m_upnpStratum);
}
@@ -601,6 +602,7 @@ void StratumServer::reset_share_counters()
m_cumulativeHashesAtLastShare = m_cumulativeHashes;
m_totalFoundSidechainShares = 0;
m_totalFailedSidechainShares = 0;
m_lastSidechainShareFoundTime = 0;
}
bool StratumServer::http_enabled() const
@@ -791,7 +793,7 @@ void StratumServer::on_blobs_ready()
// Not logged in yet, on_login() will send the job to this client. Also close inactive connections.
if (cur_time >= client->m_connectedTime + 10) {
LOGWARN(4, "client " << static_cast<char*>(client->m_addrString) << " didn't send login data");
client->ban(DEFAULT_BAN_TIME);
client->ban(m_banTime);
client->close();
}
continue;
@@ -891,6 +893,26 @@ void StratumServer::update_hashrate_data(uint64_t hashes, uint64_t timestamp)
if (hashes) {
m_cumulativeHashes += hashes;
++m_totalStratumShares;
// P2Pool-nano warning
#ifndef P2POOL_LOG_DISABLE
// Check the hashrate when enough shares is found
if (((m_totalStratumShares & 63) == 0) && m_pool->side_chain().is_nano()) {
const HashrateData& head = m_hashrateData[m_hashrateDataHead];
const HashrateData& tail = m_hashrateData[m_hashrateDataTail_24h];
const int64_t dt = static_cast<int64_t>(head.m_timestamp - tail.m_timestamp);
if (dt > 0) {
const uint64_t total_hashes = head.m_cumulativeHashes - tail.m_cumulativeHashes;
const uint64_t hashrate = total_hashes / dt;
if (hashrate > 30000) {
LOGINFO(0, log::LightRed() << "Your hashrate is " << log::Hashrate(hashrate) << ". Please switch from P2Pool-nano to P2Pool-mini or P2Pool-main. P2Pool-nano is recommended only for small-scale miners.");
}
}
}
#endif // P2POOL_LOG_DISABLE
}
HashrateData* data = m_hashrateData;
@@ -985,6 +1007,8 @@ void StratumServer::on_share_found(uv_work_t* req)
share->m_score = GOOD_SHARE_POINTS;
const double diff = sidechain_difficulty.to_double();
time_t prev_time;
const time_t cur_time = time(nullptr);
{
WriteLock lock(server->m_hashrateDataLock);
@@ -994,6 +1018,9 @@ void StratumServer::on_share_found(uv_work_t* req)
server->m_cumulativeFoundSharesDiff += diff;
++server->m_totalFoundSidechainShares;
prev_time = server->m_lastSidechainShareFoundTime;
server->m_lastSidechainShareFoundTime = cur_time;
}
if (!pool->submit_sidechain_block(share->m_templateId, share->m_nonce, share->m_extraNonce)) {
@@ -1002,6 +1029,7 @@ void StratumServer::on_share_found(uv_work_t* req)
if (server->m_totalFoundSidechainShares > 0) {
--server->m_totalFoundSidechainShares;
++server->m_totalFailedSidechainShares;
server->m_lastSidechainShareFoundTime = prev_time;
}
}
}
@@ -1086,7 +1114,7 @@ void StratumServer::on_after_share_found(uv_work_t* req, int /*status*/)
client->m_score += share->m_score;
if (bad_share && (client->m_score <= BAN_THRESHOLD_POINTS)) {
client->ban(DEFAULT_BAN_TIME);
client->ban(server->m_banTime);
client->close();
}
else if (!result) {
@@ -1094,7 +1122,7 @@ void StratumServer::on_after_share_found(uv_work_t* req, int /*status*/)
}
}
else if (bad_share) {
server->ban(share->m_clientIPv6, share->m_clientAddr, DEFAULT_BAN_TIME);
server->ban(share->m_clientIPv6, share->m_clientAddr, server->m_banTime);
}
if (share->m_allocated) {
@@ -1204,7 +1232,7 @@ bool StratumServer::StratumClient::on_read(const char* data, uint32_t size)
auto on_parse = [this](const char* data, uint32_t size) {
if (static_cast<size_t>(m_stratumReadBufBytes) + size > STRATUM_BUF_SIZE) {
LOGWARN(4, "client " << static_cast<const char*>(m_addrString) << " sent too long Stratum message");
ban(DEFAULT_BAN_TIME);
ban(static_cast<StratumServer*>(m_owner)->m_banTime);
return false;
}
@@ -1232,7 +1260,7 @@ bool StratumServer::StratumClient::on_read(const char* data, uint32_t size)
*c = '\0';
if (!process_request(line_start, static_cast<uint32_t>(c - line_start))) {
ban(DEFAULT_BAN_TIME);
ban(static_cast<StratumServer*>(m_owner)->m_banTime);
return false;
}
@@ -1474,6 +1502,7 @@ void StratumServer::api_update_local_stats(uint64_t timestamp)
uint64_t hashes_since_last_share;
double average_effort;
uint32_t shares_found, shares_failed;
time_t last_share_found_time;
uint64_t total_stratum_shares;
{
@@ -1505,6 +1534,7 @@ void StratumServer::api_update_local_stats(uint64_t timestamp)
shares_found = m_totalFoundSidechainShares;
shares_failed = m_totalFailedSidechainShares;
last_share_found_time = m_lastSidechainShareFoundTime;
total_stratum_shares = m_totalStratumShares;
}
@@ -1526,6 +1556,7 @@ void StratumServer::api_update_local_stats(uint64_t timestamp)
<< ",\"hashrate_24h\":" << hashrate_24h
<< ",\"total_hashes\":" << total_hashes
<< ",\"total_stratum_shares\":" << total_stratum_shares
<< ",\"last_share_found_time\":" << last_share_found_time
<< ",\"shares_found\":" << shares_found
<< ",\"shares_failed\":" << shares_failed
<< ",\"average_effort\":" << average_effort
@@ -1533,6 +1564,7 @@ void StratumServer::api_update_local_stats(uint64_t timestamp)
<< ",\"connections\":" << connections
<< ",\"incoming_connections\":" << incoming_connections
<< ",\"block_reward_share_percent\":" << block_reward_share_percent
<< ",\"wallet\":\"" << m_pool->params().m_wallet << '"'
<< ",\"workers\":[";
const difficulty_type pool_diff = m_pool->side_chain().difficulty();
+3
View File
@@ -203,8 +203,11 @@ private:
double m_cumulativeFoundSharesDiff;
uint32_t m_totalFoundSidechainShares;
uint32_t m_totalFailedSidechainShares;
time_t m_lastSidechainShareFoundTime;
uint64_t m_totalStratumShares;
uint64_t m_banTime;
std::atomic<uint64_t> m_apiLastUpdateTime;
std::deque<SubmittedShare*> m_pendingShareChecks;
+30 -2
View File
@@ -615,6 +615,34 @@ void TCPServer::loop(void* data)
TCPServer* server = static_cast<TCPServer*>(data);
log_category_prefix = server->get_log_category();
{
size_t n = strlen(log_category_prefix);
if (n > 1) {
// Discard the last character (space)
--n;
char buf[16] = {};
if (n < sizeof(buf)) {
// Set the thread name as is
memcpy(buf, log_category_prefix, n);
}
else {
// Thread name is too long, use the "first 7 characters - last 7 characters" format
constexpr size_t k = sizeof(buf) / 2 - 1;
memcpy(buf, log_category_prefix, k);
buf[k] = '-';
memcpy(buf + k + 1, log_category_prefix + n - k, k);
}
set_thread_name(buf);
}
else {
set_thread_name("TCPServer");
}
}
LOGINFO(1, "event loop started");
server_event_loop_thread = data;
@@ -1120,7 +1148,7 @@ bool TCPServer::Client::on_proxy_handshake(const char* data, uint32_t size)
switch (m_socks5ProxyState) {
case Socks5ProxyState::MethodSelectionSent:
if (m_numRead >= 2) {
if ((m_readBuf[0] != 5) && (m_readBuf[1] != 0)) {
if ((m_readBuf[0] != 5) || (m_readBuf[1] != 0)) {
LOGWARN(5, "SOCKS5 proxy returned an invalid METHOD selection message");
return false;
}
@@ -1164,7 +1192,7 @@ bool TCPServer::Client::on_proxy_handshake(const char* data, uint32_t size)
case Socks5ProxyState::ConnectRequestSent:
if (m_numRead >= 4) {
const uint8_t* p = reinterpret_cast<uint8_t*>(m_readBuf);
if ((p[0] != 5) && (p[1] != 0) && p[2] != 0) {
if ((p[0] != 5) || (p[1] != 0) || p[2] != 0) {
LOGWARN(5, "SOCKS5 proxy returned an invalid reply to CONNECT");
return false;
}
+19
View File
@@ -60,6 +60,8 @@ const char* VERSION = "v" STR2(P2POOL_VERSION_MAJOR) "." STR2(P2POOL_VERSION_MIN
#endif
" on " __DATE__ ")";
const uint8_t ED25519_MASTER_PUBLIC_KEY[32] = {51,175,37,73,203,241,188,115,195,255,123,53,218,120,90,74,186,240,82,178,67,139,124,91,180,106,188,181,187,51,236,10};
std::string DATA_DIR;
SoftwareID get_software_id(uint32_t value)
@@ -846,4 +848,21 @@ NOINLINE PerfTimer::~PerfTimer()
LOGINFO(m_level, m_name << " took " << dt.count() << " ms");
}
void set_thread_name(const char* name)
{
#if (UV_VERSION_MAJOR > 1) || ((UV_VERSION_MAJOR == 1) && (UV_VERSION_MINOR >= 50))
const int err = uv_thread_setname(name);
if (err) {
LOGERR(1, "uv_thread_setname failed for " << name << ", error " << uv_err_name(err));
}
#elif defined(HAVE_PTHREAD_SETNAME_NP)
const int err = pthread_setname_np(pthread_self(), name);
if (err) {
LOGERR(1, "pthread_setname_np failed for " << name << ", error " << err);
}
#else
(void)name;
#endif
}
} // namespace p2pool
+13 -2
View File
@@ -35,13 +35,15 @@
namespace p2pool {
#define P2POOL_VERSION_MAJOR 4
#define P2POOL_VERSION_MINOR 4
#define P2POOL_VERSION_MINOR 8
#define P2POOL_VERSION_PATCH 0
constexpr uint32_t P2POOL_VERSION = (P2POOL_VERSION_MAJOR << 16) | (P2POOL_VERSION_MINOR << 8) | P2POOL_VERSION_PATCH;
extern const char* VERSION;
extern const uint8_t ED25519_MASTER_PUBLIC_KEY[32];
extern std::string DATA_DIR;
enum class SoftwareID : uint32_t {
@@ -67,7 +69,16 @@ template<typename T>
struct ScopeGuard : public nocopy_nomove
{
explicit FORCEINLINE ScopeGuard(T&& handler) : m_handler(std::move(handler)) {}
FORCEINLINE ~ScopeGuard() { m_handler(); }
FORCEINLINE ~ScopeGuard()
{
// Because the handler can throw an exception, and we don't want exceptions in a destructor
try {
m_handler();
}
catch(...) {
}
}
T m_handler;
};
+2
View File
@@ -232,4 +232,6 @@ void parallel_run(uv_loop_t* loop, T&& callback, bool wait = false)
}
}
void set_thread_name(const char* name);
} // namespace p2pool
+10 -1
View File
@@ -42,9 +42,10 @@ ZMQReader::ZMQReader(const std::string& address, uint32_t zmq_port, const std::s
addr_buf[0] = '\0';
std::random_device rd;
std::mt19937_64 rng(rd());
for (uint32_t i = 0; i < 100; ++i) {
const uint32_t port = 49152 + (rd() % 16384);
const uint32_t port = 49152 + (rng() % 16384);
try {
log::Stream s(addr_buf);
@@ -130,6 +131,8 @@ void ZMQReader::monitor_thread(void* arg)
{
LOGINFO(1, "monitor thread ready");
set_thread_name("ZMQ monitor");
ZMQReader* r = reinterpret_cast<ZMQReader*>(arg);
do {} while (!r->m_stopped && r->m_monitor->m_connected && r->m_monitor->check_event(-1));
@@ -151,6 +154,8 @@ void ZMQReader::run()
m_workerThreadRunning = true;
ON_SCOPE_LEAVE([this]() { m_workerThreadRunning = false; });
set_thread_name("ZMQ worker");
zmq_msg_t message = {};
try {
@@ -211,6 +216,7 @@ bool ZMQReader::connect(const std::string& address, bool keep_monitor)
if (!id) {
std::random_device rd;
id = (static_cast<uint64_t>(rd()) << 32) | static_cast<uint32_t>(rd());
id >>= 1; // to avoid MAX_UINT64 case
}
char buf[64];
@@ -227,6 +233,9 @@ bool ZMQReader::connect(const std::string& address, bool keep_monitor)
m_subscriber.connect(address);
while (!monitor->m_connected && monitor->check_event(-1)) {
if (monitor->m_connected) {
break;
}
if (duration_cast<milliseconds>(steady_clock::now() - start_time).count() >= 1000) {
LOGERR(1, "failed to connect to " << address);
delete monitor;
+9 -2
View File
@@ -22,14 +22,21 @@ if (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
include(cmake/msvc_libs.cmake)
endif()
add_subdirectory(../external/src/RandomX RandomX)
set(LIBS ${LIBS} randomx)
if (STATIC_LIBS AND WIN32 AND (CMAKE_CXX_COMPILER_ID MATCHES Clang))
set(LIBS ${LIBS} "${CMAKE_SOURCE_DIR}/../build/external/src/RandomX/librandomx.a")
else()
add_subdirectory(../external/src/RandomX RandomX)
set(LIBS ${LIBS} randomx)
endif()
add_definitions(-DWITH_RANDOMX)
add_subdirectory(cmake/ssl)
include_directories(../external/src/grpc/third_party/boringssl-with-bazel/src/include)
add_definitions(-DWITH_TLS)
add_definitions(-DWITH_MERGE_MINING_DONATION)
add_definitions(-DP2POOL_UNIT_TESTS)
add_definitions(-DP2POOL_SIDECHAIN_EXTRA_1=1)