Repository navigation
test(dash): decode real Core v24 vectors from a devnet - #1158
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1158 +/- ##
==========================================
+ Coverage 78.62% 78.71% +0.09%
==========================================
Files 302 302
Lines 80505 80505
==========================================
+ Hits 63294 63372 +78
+ Misses 17211 17133 -78
|
The ProRegTx, ProUpServTx and ProUpRegTx version 3 parsers and the CbTx version 4 parser had no real vectors, since regtest dashd does not run Core v24. This adds bytes produced by Dash Core v24.0.0-rc.3 on devnet "Jameson" (V24 active since height 15000), fetched through DAPI `Core/getTransaction` and `Core/getBlock`. Each transaction hashes to its txid. - Three regular ProRegTx v3 (one P2PKH payout, two payouts at 6000/4000, one P2SH payout), an EvoNode ProUpServTx v3 and a ProUpRegTx v3. Each decodes typed at version 3, re-encodes to the same bytes, keeps its txid and reports a size() equal to its encoding. The payout, address, platform node id and port facts are pinned. - The V24 activation block and the five blocks that mined those transactions. Every transaction re-encodes to its exact slice of the block with no payload left raw, the merkle root checks, and the coinbase is a CbTx v4 at the block's height with an all-zero asset-unlocks root. All 11 tests pass on dev. On rev 40268cc, which predates these payload types, every vector fails to decode, so the tests can fail. Part of #1047. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9d3cc57 to
c4dcf45
Compare
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
|
Bots are done — your move: post |
|
/self-reviewed |
|
Ready for review — files with no dedicated owner: QuantumExplorer or ZocoLini or xdustinface. |
Part of #1047.
The v3 parsers for ProRegTx, ProUpServTx and ProUpRegTx (#1138, #1152) and CbTx v4 (#1137) were added without real vectors, because our regtest dashd doesn't run Core v24. This adds real bytes produced by Dash Core v24 and tests that decode them.
The vectors
They come from devnet "Jameson". Every node there runs Dash Core v24.0.0-rc.3, and V24 activated at height 15000. The bytes were fetched through DAPI
Core/getTransactionandCore/getBlockand stored as hex underdash/tests/data/core_v24_devnet/. Each transaction file's sha256d, reversed, equals its txid.pro_reg_tx_v3_one_payout.hex20814c48…0b5d07c2pro_reg_tx_v3_two_payouts.hexf7e6fad0…08b38adbpro_reg_tx_v3_p2sh_payout.hex1bff9d39…42fb496f8yyRcXHGCXypDWTCNZMHUYZJJEC87GqLfK(a 1-of-1 multisig)evo_pro_up_serv_tx_v3.hex7c58d977…0f5e51acpro_up_reg_tx_v3.hex16b69f49…79e55775There are also six blocks.
block_15000.hexis the V24 activation block, which carries the first CbTx v4. The other five are the blocks that mined the transactions above.What is tested
dash/tests/core_v24_devnet_vectors.rs:Each transaction:
to_*_payload());txid()matches Core's txid;size()equals its encoded length.Plus the facts specific to each vector:
script_payoutand no platform node id. Each registers with an empty extended address list (version 1) and the default shared collateral.yQohnoFhM5avKnzVzAX79xT8uCKviaPxj4that takes the whole owner reward (10000).[6000, 4000]to two different P2PKH scripts.8yyRcXHGCXypDWTCNZMHUYZJJEC87GqLfK.mn_type1) whose platform node id isf958365178aaf234a101db3a34025bdf5f6ed315;platform_p2p_portorplatform_http_port;pro_tx_hashis the one-payout ProRegTx's txid;yT7ShTqEqPBskpTAiHzWaAggFmD4j1MCT3.Each block:
check_merkle_root()passes;merkle_root_asset_unlockspresent (all-zero, since none of these blocks carries an asset unlock);Only tests and test data are added. No production code changes.
Not covered by these vectors:
merkleRootAssetUnlocks;Results
dev(2232580f, with #1154's raw fallback and #1156)40268cc0(Dash Platform v5.0's current pin)Io(UnexpectedEof). ProUpServTx v3 fails withParseFailed("unsupported ProUpServTx version"). All 6 blocks fail withUnsupportedSegwitFlag(0), including block 15000, which only has the CbTx v4 and quorum commitments. That rev predates the v3/v4 payload types, so it was checked with a decode-only probe; the test file itself doesn't compile there.Checks on this branch:
cargo test -p dashcore: all pass (556 unit, 11 new, 12 headers2, 34 doc).cargo fmt --check: clean.cargo clippy -p dashcore --all-targets --all-features -- -D warnings: clean.cargo clippy -p dashcore --all-targets -- -D warnings(default features) already fails ondev:dash/src/hash_types.rs:361importsserde_derive::{Deserialize, Serialize}in its test module without aserdefeature gate. That is outside this change; the new test target is clippy-clean either way.🤖 Generated with Claude Code
Summary by CodeRabbit
PR Hygiene ·
c4dcf45dash/tests/core_v24_devnet_vectors.rs,dash/tests/data/core_v24_devnet/block_15000.hex,dash/tests/data/core_v24_devnet/block_15146.hexand 9 more) — QuantumExplorer or ZocoLini or xdustinfaceWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.