dgb: parity KAT for GBT prevhash formatter u256_be_display_hex - #478
Merged
Conversation
Pin coin/hash_format.hpp u256_be_display_hex (the most-significant-limb-first 64-hex render of the LE u256 that both the stratum work source and the embedded work path emit for the GBT "previousblockhash") against a non-circular oracle anchor: the DGB mainnet genesis hash pinned at p2pool-dgb-scrypt bitcoin/networks/digibyte.py:55. The test reverses that external display constant into little-endian storage bytes, feeds u256::from_le_bytes (the path a parsed tip hash takes), and asserts the formatter reproduces the canonical display string byte for byte. Additional cases pin zero/one left-padding, most-significant-limb-first limb ordering, all-ones, and the from_le_bytes byte reversal. Diagnostics / wire-display only: no consensus surface, no payout/subsidy/ version-gate value change. Header-only test (links only GTest); no production call site rewired. Fenced to src/impl/dgb/. Added to both build.yml --target allowlists (#143 NOT_BUILT trap).
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.
Summary
Fenced, additive parity KAT for the GBT block-hash display formatter
dgb::coin::u256_be_display_hex(src/impl/dgb/coin/hash_format.hpp) — themost-significant-limb-first 64-hex render of the little-endian
u256that boththe stratum work source and the embedded work path emit for the GBT
previousblockhash. The formatter had no test; a 1-nibble limb/byte-orderingdivergence there would emit a prevhash the parent daemon never accepts.
Non-circular anchor
The DGB mainnet genesis hash
7497ea1b465eb39f1c8f507bc877078fe016d6fcb6dfad3a64c98dcc6e1e8496is theexternal constant pinned by the DGB oracle at
frstrtr/p2pool-dgb-scryptbitcoin/networks/digibyte.py:55. The test parses that literal display hex withan independent reader, reverses to little-endian storage bytes, feeds
u256::from_le_bytes(the path a parsed tip hash takes), and asserts theformatter reproduces the canonical string byte for byte. Additional cases pin
zero/one left-padding, most-significant-limb-first ordering, all-ones, and the
from_le_bytesbyte reversal. 6/6 green locally.Scope / safety
payout/subsidy/version-gate value change.
src/impl/dgb/; zero shared-layer / cross-coin /bitcoin_family/
src/coreoverlap.build.yml--targetallowlists (ci: build test_dgb_subsidy in both Linux test jobs (fix master-red NOT_BUILT) #143 NOT_BUILT trap).Off
master; does not touch the #475 → #477 base chain.