dash: MSVC-portable coinbase PPLNS payout muldiv (fixes c2pool-dash Windows v0.2.1)#709
Merged
Merged
Conversation
…ash Windows) coinbase_builder.hpp evaluated the PPLNS per-script payout proportion (worker_payout * weight / total_weight, and the pre-v36 *49/(50*total) arm) in a native unsigned __int128 intermediate. __int128 is a GCC/Clang extension MSVC does not provide (error C2065: __uint128_t undeclared identifier), so the c2pool-dash Windows binary failed to compile in the v0.2.1 release build while Linux/macOS DASH passed -- the last DASH gap for the all-5-coin v0.2.1. Same class of fix already shipped for BCH abla (#688) and DGB arith256 (#690): extract the 128-bit muldiv into dash::payout::payout_share (payout_muldiv.hpp) and guard it with #if defined(__SIZEOF_INT128__). The native path keeps the __uint128_t arithmetic BYTE-EXACT for the shipping Linux/macOS packages; MSVC falls back to boost::multiprecision::uint128_t (header-only, already a c2pool dependency) which yields bit-identical results. coinbase_builder.hpp:131-138 is rewired through it; no payout amount changes on any platform. This is CONSENSUS PAYOUT math -- a one-satoshi divergence forks payouts -- so test_dash_coinbase_muldiv is the required guard: layer A pins cross-platform known answers (incl. products > 2^64) that MSVC can run without a native to diff against; layer B (#if __int128) proves native == portable across the DASH payout operand grid plus a 200k-vector deterministic fuzz, over both the v36 and pre-v36 branches. Wired into test/CMakeLists.txt and both build.yml --target allowlists. Verified locally: test_dash_coinbase_muldiv 5/5 PASS (native==portable over 200000 fuzz vectors); test_dash_coinbase_parity 10/10 unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DASH is the only coin whose Windows binary fails to compile in the v0.2.1 release build (Linux + macOS DASH are green) -- the last DASH gap for the all-5-coin v0.2.1. Root cause (MSVC run 29383023622):
```
src/impl/dash/coinbase_builder.hpp(131): error C2065: __uint128_t: undeclared identifier
```
The PPLNS per-script coinbase payout proportion was evaluated in a native `unsigned __int128` intermediate (`worker_payout * weight / total_weight`, and the pre-v36 `49 / (total50)` arm). `__int128` is a GCC/Clang extension MSVC does not provide.
Fix (mirrors BCH abla #688 / DGB arith256 #690)
Wired into `test/CMakeLists.txt` and both `build.yml` `--target` allowlists.
Local verification
Consensus surface: payout arithmetic is bit-identical to what merged; the only behavioural change is that MSVC now compiles.