diff options
author | Ryan Ofsky <ryan@ofsky.org> | 2024-08-31 09:13:11 -0400 |
---|---|---|
committer | Ryan Ofsky <ryan@ofsky.org> | 2024-08-31 10:18:00 -0400 |
commit | b52d54736168bed82775e3c9e66c6320c7b83626 (patch) | |
tree | 2c087d04281e4b41f8d6cfb49c3532744fd5044b /doc | |
parent | e96f657e20fd52a555dbfd1dd2f63892560f4f1c (diff) | |
parent | 8756ccd71218c8e013181473720b10d3c4a94957 (diff) |
Merge bitcoin/bitcoin#30377: refactor: Replace ParseHex with consteval ""_hex literals
8756ccd71218c8e013181473720b10d3c4a94957 scripted-diff: Replace ParseHex[<std::byte>]("str") -> "str"_hex[_u8] (Hodlinator)
9cb687351f7ff50d19b5c5997ed69cfdab75bbf2 refactor: Prepare for ParseHex -> ""_hex scripted-diff (Hodlinator)
50bc017040ae300c795e3709233b80619db24518 refactor: Hand-replace some ParseHex -> ""_hex (Hodlinator)
5b74a849cf5c54543280ba6488ae7f87361b1e2f util: Add consteval ""_hex[_v][_u8] literals (l0rinc)
dc5f6f681275f56ff389500e3dd98fbe791f4a45 test refactor: util_tests - parse_hex clean up (Hodlinator)
2b5e6eff36abe4c23b8789ef1babfafedc90b973 refactor: Make XOnlyPubKey tolerate constexpr std::arrays (Hodlinator)
403d86f1ccf0b73f042d42a9722bb007ba8c7a31 refactor: vector -> span in CCrypter (Hodlinator)
bd0830bbd4105af1953b6b897ba6bc35098cbe13 refactor: de-Hungarianize CCrypter (Hodlinator)
d99c81697148a9695c0fba614dff9fbe728a3acd refactor: Improve CCrypter related lines (Hodlinator)
7e1d9a84689d77a9349a3a09fd5f9dd3f9c293aa refactor: Enforce lowercase hex digits for consteval uint256 (Hodlinator)
Pull request description:
Motivation:
* Validates and converts the hex string into bytes at compile time instead of at runtime like `ParseHex()`.
* Eliminates runtime dependencies: https://github.com/bitcoin/bitcoin/pull/30377#issuecomment-2214432177, https://github.com/bitcoin/bitcoin/pull/30048#discussion_r1592108480
* Has stricter requirements than `ParseHex()` (disallows whitespace and uppercase hex digits) and replaces it in a bunch of places.
* Makes it possible to derive other compile time constants.
* Minor: should shave off a few runtime CPU cycles.
`""_hex` produces `std::array<std::byte>` as the momentum in the codebase is to use `std::byte` over `uint8_t`.
Also makes `uint256` hex string constructor disallow uppercase hex digits. Discussed: https://github.com/bitcoin/bitcoin/pull/30560#discussion_r1701323070
Surprisingly does not change the size of the Guix **bitcoind** binary (on x86_64-linux-gnu) by 1 single byte.
Spawned already merged PRs: #30436, #30482, #30532, #30560.
ACKs for top commit:
l0rinc:
ACK 8756ccd71218c8e013181473720b10d3c4a94957
stickies-v:
Rebase re-ACK 8756ccd71218c8e013181473720b10d3c4a94957, no changes since a096215c9c71a2ec03e76f1fd0bcdda0727996e0
ryanofsky:
Code review ACK 8756ccd71218c8e013181473720b10d3c4a94957, just rebasing since last review and taking advantage of CScript constructors in #29369, also tweaking a code comment
Tree-SHA512: 9b2011b7c37e0ef004c669f8601270a214b388916316458370f5902c79c2856790b1b2c7c123efa65decad04886ab5eff95644301e0d84358bb265cf1f8ec195
Diffstat (limited to 'doc')
0 files changed, 0 insertions, 0 deletions