Skip to content

test(dash): decode real Core v24 vectors from a devnet - #1158

Merged
xdustinface merged 1 commit into
devfrom
v24-real-vectors
Oct 13, 2026
Merged

xdustinface merged 1 commit into
devfrom
v24-real-vectors

Conversation

@shumkov

@shumkov shumkov commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

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/getTransaction and Core/getBlock and stored as hex under dash/tests/data/core_v24_devnet/. Each transaction file's sha256d, reversed, equals its txid.

File Txid Block What it is
pro_reg_tx_v3_one_payout.hex 20814c48…0b5d07c2 15146 Regular ProRegTx v3 (extended addresses), one P2PKH payout
pro_reg_tx_v3_two_payouts.hex f7e6fad0…08b38adb 15153 Regular ProRegTx v3, two payouts at 6000 / 4000 basis points
pro_reg_tx_v3_p2sh_payout.hex 1bff9d39…42fb496f 15166 Regular ProRegTx v3, one P2SH payout to 8yyRcXHGCXypDWTCNZMHUYZJJEC87GqLfK (a 1-of-1 multisig)
evo_pro_up_serv_tx_v3.hex 7c58d977…0f5e51ac 15182 EvoNode ProUpServTx, moved from v2 to v3 after V24 with the same addresses and ports
pro_up_reg_tx_v3.hex 16b69f49…79e55775 15190 ProUpRegTx v3 that replaces the one-payout ProRegTx's payout through the payouts list

There are also six blocks. block_15000.hex is 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:

    • it decodes;
    • the payload is the typed variant, not raw (checked with to_*_payload());
    • the payload version is 3;
    • re-encoding gives back the exact bytes;
    • txid() matches Core's txid;
    • the payload's size() equals its encoded length.

    Plus the facts specific to each vector:

    • All three ProRegTx: a regular masternode with an empty script_payout and no platform node id. Each registers with an empty extended address list (version 1) and the default shared collateral.
    • One payout: a single P2PKH payout to yQohnoFhM5avKnzVzAX79xT8uCKviaPxj4 that takes the whole owner reward (10000).
    • Two payouts: rewards [6000, 4000] to two different P2PKH scripts.
    • P2SH payout: a P2SH payout script whose devnet address is 8yyRcXHGCXypDWTCNZMHUYZJJEC87GqLfK.
    • ProUpServTx:
      • an EvoNode (mn_type 1) whose platform node id is f958365178aaf234a101db3a34025bdf5f6ed315;
      • no separate platform_p2p_port or platform_http_port;
      • the ports are in the extended addresses: CoreP2P 20001, PlatformP2P 26656, PlatformHttps 1443.
    • ProUpRegTx:
      • pro_tx_hash is the one-payout ProRegTx's txid;
      • the whole owner reward now goes to yT7ShTqEqPBskpTAiHzWaAggFmD4j1MCT3.
  • Each block:

    • it decodes;
    • every transaction re-encodes to exactly its slice of the block, and those slices add up to the whole block;
    • no special payload falls back to raw;
    • check_merkle_root() passes;
    • the coinbase payload is a CbTx v4 with the block's height and merkle_root_asset_unlocks present (all-zero, since none of these blocks carries an asset unlock);
    • each block (except 15000) contains its transaction vector byte for byte.

Only tests and test data are added. No production code changes.

Not covered by these vectors:

  • an EvoNode ProRegTx v3;
  • a ProRegTx v3 that announces addresses or shares its collateral;
  • a block with a version 2 asset unlock, which would give a non-zero merkleRootAssetUnlocks;
  • the claim that block 15000 holds the first CbTx v4. Block 14999 isn't included, so the tests only check that it holds a v4.

Results

Revision Result
dev (2232580f, with #1154's raw fallback and #1156) 11/11 pass. Every vector decodes typed, so none hides behind the raw fallback.
40268cc0 (Dash Platform v5.0's current pin) All 11 vectors fail, as expected. ProRegTx v3 ×3 and ProUpRegTx v3 fail with Io(UnexpectedEof). ProUpServTx v3 fails with ParseFailed("unsupported ProUpServTx version"). All 6 blocks fail with UnsupportedSegwitFlag(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 on dev: dash/src/hash_types.rs:361 imports serde_derive::{Deserialize, Serialize} in its test module without a serde feature gate. That is outside this change; the new test target is clippy-clean either way.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Expanded validation against Dash Core v24 devnet transactions and blocks, including serialization, transaction identifiers, block metadata, and specialized payloads.
    • Added reference data covering multiple block heights and transaction types, helping verify compatibility with real-world network data.

PR Hygiene · c4dcf45

  • Bots — coderabbitai ✓
  • Self-review — posted; again after any push
  • Build green
  • Approvals
    • files with no dedicated owner (dash/tests/core_v24_devnet_vectors.rs, dash/tests/data/core_v24_devnet/block_15000.hex, dash/tests/data/core_v24_devnet/block_15146.hex and 9 more) — QuantumExplorer or ZocoLini or xdustinface

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: dashpay/rust-dashcore/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 393849de-ce8d-46b7-be8b-161a5f565fd7
📥 Commits

Reviewing files that changed from the base of the PR and between 2232580 and c4dcf45.

📒 Files selected for processing (12)
  • dash/tests/core_v24_devnet_vectors.rs
  • dash/tests/data/core_v24_devnet/block_15000.hex
  • dash/tests/data/core_v24_devnet/block_15146.hex
  • dash/tests/data/core_v24_devnet/block_15153.hex
  • dash/tests/data/core_v24_devnet/block_15166.hex
  • dash/tests/data/core_v24_devnet/block_15182.hex
  • dash/tests/data/core_v24_devnet/block_15190.hex
  • dash/tests/data/core_v24_devnet/evo_pro_up_serv_tx_v3.hex
  • dash/tests/data/core_v24_devnet/pro_reg_tx_v3_one_payout.hex
  • dash/tests/data/core_v24_devnet/pro_reg_tx_v3_p2sh_payout.hex
  • dash/tests/data/core_v24_devnet/pro_reg_tx_v3_two_payouts.hex
  • dash/tests/data/core_v24_devnet/pro_up_reg_tx_v3.hex

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

Adds Dash Core v24 devnet transaction and block fixtures with tests for byte-identical decoding and re-encoding, transaction IDs, special-payload sizes, typed payload fields, block merkle roots, and coinbase fields.

Changes: Core v24 devnet vectors

Layer / File(s) Summary
ProRegTx payout vectors
dash/tests/core_v24_devnet_vectors.rs, dash/tests/data/core_v24_devnet/pro_reg_tx_v3_*.hex
Adds shared transaction and payout validation helpers. Tests v3 ProRegTx payouts for single and split P2PKH payees and a P2SH payee.
ProUpServTx and ProUpRegTx vectors
dash/tests/core_v24_devnet_vectors.rs, dash/tests/data/core_v24_devnet/evo_pro_up_serv_tx_v3.hex, dash/tests/data/core_v24_devnet/pro_up_reg_tx_v3.hex
Tests v3 service updates, including platform node IDs and service ports, and registration updates that replace a payout.
Block vectors
dash/tests/core_v24_devnet_vectors.rs, dash/tests/data/core_v24_devnet/block_*.hex
Adds checks for six blocks, including byte-identical round trips, merkle roots, version-4 coinbase heights, zero asset-unlock roots, and associated transaction bytes.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to c4dcf

This change only adds test vectors and tests for Dash Core v24 devnet decoding. It does not affect production behavior, so merge risk is minimal.

Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 1 files. (11 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding tests that decode real Dash Core v24 devnet vectors.
Full details: Docstring Coverage

Explanation

Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 1 files. (11 skipped: 11 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.71%. Comparing base (2232580) to head (c4dcf45).
⚠️ Report is 1 commits behind head on dev.

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     
Flag Coverage Δ
core 77.16% <ø> (+0.06%) ⬆️
ffi 51.96% <ø> (+0.66%) ⬆️
rpc 49.36% <ø> (ø)
spv 92.62% <ø> (-0.03%) ⬇️
wallet 82.12% <ø> (ø)
see 25 files with indirect coverage changes

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>
@shumkov
shumkov marked this pull request as ready for review October 13, 2026 04:46
@github-actions

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Oct 13, 2026
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Oct 13, 2026
@shumkov

shumkov commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator Author

/self-reviewed

@github-actions github-actions Bot removed the waiting-self-review Waiting for the author to post /self-reviewed label Oct 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Ready for review — files with no dedicated owner: QuantumExplorer or ZocoLini or xdustinface.
Full checklist in the description.

@github-actions github-actions Bot added the ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human. label Oct 13, 2026
@xdustinface
xdustinface merged commit 0f2619f into dev Oct 13, 2026
42 of 45 checks passed
@xdustinface
xdustinface deleted the v24-real-vectors branch October 13, 2026 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants