Skip to content

fix: guard deprecated service netInfo access#7344

Open
thepastaclaw wants to merge 1 commit into
dashpay:developfrom
thepastaclaw:fix/deprecatedrpc-netinfo-null
Open

fix: guard deprecated service netInfo access#7344
thepastaclaw wants to merge 1 commit into
dashpay:developfrom
thepastaclaw:fix/deprecatedrpc-netinfo-null

Conversation

@thepastaclaw

Copy link
Copy Markdown

Fix deprecated service netInfo access

Issue being fixed or feature implemented

Malformed provider-register and provider-service-update payloads can be
decoded by raw transaction RPCs before special transaction validation has run.
When
-deprecatedrpc=service is enabled, the deprecated service JSON field
dereferenced netInfo directly, which could terminate the process if the
decoded provider payload left netInfo unset.

What was done?

  • Routed deprecated service JSON rendering through a small helper that applies
    CHECK_NONFATAL before reading netInfo.
  • Applied the helper to masternode state, provider-register payloads,
    provider-service-update payloads, and simplified masternode list entries.
  • Added functional coverage for malformed ProRegTx and ProUpServTx raw
    transaction decoding under -deprecatedrpc=service.

How Has This Been Tested?

Tested on macOS 15.6 arm64 with depends-based local build:

  • git diff --check
  • python3 -m py_compile test/functional/rpc_deprecated.py
  • make -j8 src/dashd
  • test/functional/rpc_deprecated.py --cachedir=/Users/claw/.openclaw/workspace/cache/dash-functional

The focused functional test verifies both malformed provider payload types
return a nonfatal RPC error and the node remains responsive.

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)

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

✅ No Merge Conflicts Detected

This PR currently has no conflicts with other open PRs.

@thepastaclaw

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jun 8, 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

Run ID: adf4d337-29db-4206-9d0f-828e70d90dbd

📥 Commits

Reviewing files that changed from the base of the PR and between 317917a and 2ab467a.

📒 Files selected for processing (2)
  • src/evo/core_write.cpp
  • test/functional/rpc_deprecated.py

Walkthrough

This PR refactors deprecated service field generation in core_write.cpp by introducing a centralized helper function GetDeprecatedServiceField() that wraps validation and error handling. The helper is called by four ToJson() implementations instead of directly accessing netInfo->GetPrimary(). A corresponding functional test adds a third node configuration and verifies that malformed transaction payloads trigger the expected internal error responses without affecting chain state.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding a guard (CHECK_NONFATAL) for deprecated service netInfo access to prevent crashes.
Description check ✅ Passed The description is directly related to the changeset, explaining the issue being fixed, the solution implemented, and the testing performed.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Infer (1.2.0)
src/evo/core_write.cpp

src/evo/core_write.cpp:5:10: fatal error: 'evo/assetlocktx.h' file not found
5 | #include <evo/assetlocktx.h>
| ^~~~~~~~~~~~~~~~~~~
1 error generated.
Error: the following clang command did not run successfully:
/opt/infer-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-18
@/tmp/coderabbit-infer/2ab467a63c69640946fde01da2da24abc828e961-3a87bb1f7ee2b853/tmp/clang_command_.tmp.ffe11f.txt
++Contents of '/tmp/coderabbit-infer/2ab467a63c69640946fde01da2da24abc828e961-3a87bb1f7ee2b853/tmp/clang_command_.tmp.ffe11f.txt':
"-cc1" "-load"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../../facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib"
"-add-plugin" "BiniouASTExporter" "-plugin-arg-BiniouASTExporter" "-"
"-plugin-arg-BiniouASTExporter" "PREPEND_CURRENT_DIR=1"
"-plugin-arg-BiniouASTExporter" "MAX_STRING_SIZE=65535" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disa

... [truncated 1071 characters] ...

lang/install/lib/clang/18/include"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-Wno-ignored-optimization-argument" "-Wno-everything"
"-fdeprecated-macro" "-ferror-limit" "19" "-fgnuc-version=4.2.1"
"-fskip-odr-check-in-gmf" "-fcxx-exceptions" "-fexceptions"
"-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o"
"/tmp/coderabbit-infer/3a87bb1f7ee2b853/file.o" "-x" "c++"
"src/evo/core_write.cpp" "-O0" "-fno-builtin" "-include"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../lib/clang_wrappers/global_defines.h"
"-Wno-everything"


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 and usage tips.

@thepastaclaw thepastaclaw marked this pull request as ready for review June 9, 2026 03:38
@thepastaclaw

thepastaclaw commented Jun 9, 2026

Copy link
Copy Markdown
Author

✅ Review complete (commit 2ab467a)

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Code Review

Small, well-scoped fix that prevents a remote-attacker-triggerable crash via decoderawtransaction under -deprecatedrpc=service when the special-tx payload deserializer bails out early and leaves netInfo null. The patch routes all four deprecated service renderers through a CHECK_NONFATAL-guarded helper and adds a targeted functional test for malformed ProRegTx/ProUpServTx payloads. Both reviewers (Claude and Codex) found no in-scope blocking issues; only minor test-brittleness nitpicks were raised.

💬 1 nitpick(s)

block_count = node.getblockcount()
for tx_hex in [
"03000100000000000000020000", # ProRegTx with only nVersion=0 payload
"03000200000000000000020000", # ProUpServTx with only nVersion=0 payload

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

💬 Nitpick: Brittle assertion couples test to helper parameter name

The substring "Internal bug detected: obj.netInfo" binds the test to the CHECK_NONFATAL stringification of the condition, which depends on the helper's parameter being named obj in src/evo/core_write.cpp. Renaming the parameter (e.g. to state or tx) would break this assertion for reasons unrelated to the bug being guarded. Matching on "Internal bug detected" alone would still confirm the non-fatal path was taken without binding to internal naming.

source: ['claude']

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.

1 participant