Skip to content

tidy & suppressions#165

Draft
l0rinc wants to merge 14 commits into
masterfrom
detached525
Draft

tidy & suppressions#165
l0rinc wants to merge 14 commits into
masterfrom
detached525

Conversation

@l0rinc
Copy link
Copy Markdown
Owner

@l0rinc l0rinc commented May 9, 2026

No description provided.

l0rinc added 14 commits March 4, 2026 14:46
Define `uint160::FromHex`, `uint256::FromHex`, and `uint256::FromUserHex` in `uint256.cpp` and keep only declarations in `uint256.h`.

Drop heavy `util/strencodings.h` and `util/string.h` includes from `uint256.h` by using a local consteval hex helper for literal construction and non-inline parsing helpers in the `.cpp` file.

Add direct includes in `musig.cpp` and `outputtype.cpp` for symbols that were previously provided transitively via `uint256.h`.
Drop the heavy chainparams dependency from `key_io.h` and include it directly in the implementation and test files that use `Params()` or `SelectParams()`.
Move the SetupServerArgs implementation out of `init.cpp` into a dedicated translation unit and add it to the build.

This keeps `init.cpp` smaller and isolates server argument registration code in one place.
Make ParseHDKeypath() accept h as a hardened suffix so it can parse the default output of WriteHDKeypath() again, and cover both ' and h in the wallet test and fuzz target.

Add roundtrip checks for the text and serialization paths that were most likely to hide asymmetries, including network permissions, net addresses, scripts, transactions, PSBTs, money strings, and compressed txout/coin deserialization.

Reject out-of-range values in AmountCompression::Unser() instead of materializing invalid CAmounts, and add a minimal unit reproducer plus focused deserialize fuzz assertions for TxOutCompression, Coin, CTxUndo, and CBlockUndo.
The existing harness assigns `backend_coins_view = CCoinsView{}` before calling `SetBackend()`.
That is a slice-assignment noop, so the cache never actually switches to a different backend.

Use a separate empty backend instance and track the active backend explicitly.
When restoring the original backend after using the empty backend, reset the cache first because dirty and `FRESH` state is relative to the current parent view.

This keeps exercising `SetBackend()` while matching the real production pattern of switching to an empty backend to freeze already-cached entries instead of carrying state across unrelated parents.
Return early from `SetStdinEcho` when stdin is not a terminal, and check the platform calls before updating terminal state.

This avoids the ENOTTY path fixed upstream in PR bitcoin#34597 and lets the `SetStdinEcho` integer sanitizer suppression be removed. The suppression was originally added broadly in `fa1bfc476c9` for PR bitcoin#17517 and narrowed to this symbol in `fd30e9688e1` for PR bitcoin#28865.
Mask off the hardened bit instead of shifting it away, preserving the formatted path while avoiding a left-shift sanitizer report for hardened child indexes.

The broad `util/bip32.cpp` suppression was added in `f0f8b1a076c` for PR bitcoin#21000 and narrowed to `FormatHDKeypath` in `fd30e9688e1` for PR bitcoin#28865.
Check future entry heights before subtracting in `TxConfirmStats::removeTx`, and compute the unconfirmed ring index in `EstimateMedianVal` without relying on unsigned underflow.

This removes the fee-estimator integer sanitizer suppressions while preserving the same ring-buffer lookup semantics. The reports were originally covered by the broad PR bitcoin#21000 suppressions in `f0f8b1a076c` and narrowed to these symbols in `fd30e9688e1` for PR bitcoin#28865.
Extract the next chunk by right-shifting into position before writing it into the byte buffer.

This preserves the bitstream output while avoiding left shifts into the sign bit of the fixed-width integer path. The `streams.h` suppression was added by `f0f8b1a076c` for PR bitcoin#21000 to keep integer-sanitized fuzz runs quiet.
Return `uint64_t::max()` before amount compression or decompression would overflow, leaving valid money-range encodings unchanged while letting callers reject malformed out-of-range amounts explicitly.

This removes the `CompressAmount`, `DecompressAmount`, and stale `compressor.h` sanitizer suppressions. The amount suppressions were narrowed in `fd30e9688e1` for PR bitcoin#28865, and the `compressor.h` sign-change suppression traces back to `fa1bfc476c9` for PR bitcoin#17517.
Compute bloom hash seeds in a wider type before the intentional 32-bit truncation, and form rolling-generation masks without unsigned subtraction from zero.

This preserves the filter behavior while removing the bloom integer sanitizer suppressions. The per-symbol bloom suppressions were added in `fd30e9688e1` for PR bitcoin#28865 after the earlier broad integer sanitizer suppressions from PR bitcoin#21000.
Accumulate the byte counts with shifts instead of multiplying by the Hamming-weight constant in the 64-bit path.

This keeps the same popcount result while removing the `bitset_detail::PopCount` integer sanitizer suppression. The suppression was added with `59a6df6bd5`, merged in PR bitcoin#30160 when the BitSet implementation was introduced.
Remove the per-symbol `EvalScript` implicit sign-change suppression after focused script and transaction unit tests no longer report an interpreter warning.

The suppression was narrowed to `EvalScript` in `fd30e9688e1` for PR bitcoin#28865 after earlier interpreter integer-sanitizer cleanups removed broader suppressions.
Use real byte buffers for the lockedpool arena tests and benchmark instead of fabricating pointer values from integers.

This makes the project sources clean enough to re-enable `performance-no-int-to-ptr` in the main and libmultiprocess tidy configs. The check was disabled in `03ec5b6f9c` for PR bitcoin#26642 when `performance-*` checks were being added and excluded selectively.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant