Skip to content

refactor(utils): consolidate masternode test helpers - #7536

Merged
PastaPastaPasta merged 1 commit into
dashpay:developfrom
PastaPastaPasta:codex/consolidate-masternode-test-utils
Aug 3, 2026
Merged

refactor(utils): consolidate masternode test helpers#7536
PastaPastaPasta merged 1 commit into
dashpay:developfrom
PastaPastaPasta:codex/consolidate-masternode-test-utils

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

Masternode unit tests duplicated the same UTXO selection, transaction funding, signing, and ProRegTx construction helpers. Fixes to this plumbing had to be repeated in every copy, and unspendable coinbase outputs could enter the test UTXO map.

What was done?

  • Added test/util/masternode.{h,cpp} as the shared location for the common masternode transaction helpers.
  • Updated block_reward_reallocation_tests and evo_deterministicmns_tests to use the shared utility.
  • Made BuildSimpleUtxoMap skip unspendable outputs such as OP_RETURN.
  • Added direct regression coverage for the unspendable-output filter.
  • Registered the new module in the test build and Dash non-backported lint list.

How Has This Been Tested?

  • make -C src -j8 test/test_dash
  • ./src/test/test_dash --run_test=block_reward_reallocation_tests
  • ./src/test/test_dash --run_test=evo_dip3_activation_tests
  • test/lint/lint-whitespace.py
  • test/lint/lint-includes.py
  • test/lint/lint-include-guards.py
  • git diff --check

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

This pull request was created by Codex.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8eb69bc8-1459-473c-a707-2ff422bdc487

📥 Commits

Reviewing files that changed from the base of the PR and between 84c0a1e and 5d52ff2.

📒 Files selected for processing (6)
  • src/Makefile.test_util.include
  • src/test/block_reward_reallocation_tests.cpp
  • src/test/evo_deterministicmns_tests.cpp
  • src/test/util/masternode.cpp
  • src/test/util/masternode.h
  • test/util/data/non-backported.txt
🚧 Files skipped from review as they are similar to previous changes (5)
  • src/test/block_reward_reallocation_tests.cpp
  • test/util/data/non-backported.txt
  • src/Makefile.test_util.include
  • src/test/util/masternode.h
  • src/test/evo_deterministicmns_tests.cpp

Walkthrough

This change adds shared masternode test utilities for UTXO selection, transaction funding and signing, provider-registration creation, and payout script generation. Existing tests use these shared helpers instead of local implementations. A test verifies that BuildSimpleUtxoMap excludes unspendable OP_RETURN outputs. The utilities are included in the test build and marked as non-backported.

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

Sequence Diagram(s)

sequenceDiagram
  participant MasternodeTest
  participant CreateProRegTx
  participant FundTransaction
  participant SignTransaction
  MasternodeTest->>CreateProRegTx: create provider-registration transaction
  CreateProRegTx->>FundTransaction: fund collateral
  FundTransaction-->>CreateProRegTx: funded inputs and change
  CreateProRegTx->>SignTransaction: sign transaction inputs
  SignTransaction-->>CreateProRegTx: signed transaction
  CreateProRegTx-->>MasternodeTest: provider-registration transaction
Loading

Possibly related PRs

  • dashpay/dash#7437: Extracts shared test helpers for masternode registration transactions.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the consolidation of duplicated masternode test helpers.
Description check ✅ Passed The description accurately explains the shared utilities, test updates, regression coverage, and build configuration changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@thepastaclaw

thepastaclaw commented Aug 3, 2026

Copy link
Copy Markdown

ℹ️ Review superseded (commit 5d52ff2)
Last checked: 2026-08-03 18:40 UTC

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

This pull request has conflicts, please rebase.

@PastaPastaPasta
PastaPastaPasta force-pushed the codex/consolidate-masternode-test-utils branch 2 times, most recently from bd1e5ca to 84c0a1e Compare August 3, 2026 17:49
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Potential PR merge conflicts

This is advisory only. It does not block CI, but it marks PRs that will likely need a rebase depending on merge order.

If this PR merges first

These open PRs will likely need a rebase:

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

This pull request has conflicts, please rebase.

@PastaPastaPasta
PastaPastaPasta force-pushed the codex/consolidate-masternode-test-utils branch from 84c0a1e to 5d52ff2 Compare August 3, 2026 18:29
@PastaPastaPasta
PastaPastaPasta merged commit 9b103c0 into dashpay:develop Aug 3, 2026
30 of 36 checks passed
@PastaPastaPasta
PastaPastaPasta deleted the codex/consolidate-masternode-test-utils branch August 3, 2026 19:41
@PastaPastaPasta PastaPastaPasta added this to the 24 milestone Aug 4, 2026
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.

2 participants